Are you free to redesign/change the interface?
If so, have you considered separating the control options into predefined logical groups? If you isolate the most common queries and optimize the UI for those, you should be able to simplify things a bit.
This way you could split the filters into two groups, positive (include) and negative (not including):
Show products with [IDs]: 40, 88, 102, 144... (Represented by a single row for simplicity)
Show products with [Title] [equal to, containing, not containing]: "Foobar"
Exclude products with [description] [equal to, containing, not containing] "Test"
Exclude products with [IDs]: 9, 15, 111
[ ] denotes a drop-down selection
The logic/query on the back end would look something like:
SELECT * FROM products
(productID IN('40, 88, 102, 144') OR productTitle = 'Foobar')
(productDescription != 'Test' OR productID NOT IN('9, 15, 111')
You are trading the ability to create finely tuned filters/queries for simplicity. In most cases this is preferred when the users of the tool doesn't possess the knowledge of how the filters interact with each other.