I have implemented something very similar for a project I am working on. The way I handled it was to save the conditions as a tree Eg. in your case there would be 1 root element with A and B (a column for each pointing to a new id) A points to the first rule and B point to the second. Now I start with setting the default return to false, and the check A and B. The result of each i run though
if(A && B) {
return true
}
Now this is taking further by expanding the tree A can point to first rule, and B can point to a new branch which then points to a new A and B (thereby having 3 rules).
This might seem complex but after building a recursive function it works quite perfect :)
