Recursively look for key equality condition before building where clause