Fortunately, this complicated database query is no longer needed. WordPress 4.1 added the ability to make complex nested meta queries which is exactly the thing I was trying to accomplish.
Here is the Trac ticket with the feature: https://core.trac.wordpress.org/ticket/29642