If I understood correctly, you would write a request, so you would need to make sure that any operation that you want to perform in the first place should be included in parentheses to obtain the desired result.
eg. I have a DEMO table with Demo, which is an entity class with fields a, b, and c. Thus, according to your requirement, the request will look like this:
Select * from Demo d where (da = "SOME_VALUE" or db = "SOME_VALUE") and dc = "SOME_VALUE"
source share