Chipotle Interview Question

How to optimize a query?