In MySQL, AND has a higher precedence than OR. [
MySQL Manual: Operator Precedence] Therefore, in your query, "category_id5 IN ... && coupon_zip IN ..." will be evaluated first. Next, that result will be used in the comparison "
result && coupon_status = 'ACTIVE'". Then the ORs will be evaluated, starting with the leftmost comparison following "WHERE".
Use parentheses to group the comparisons so they will be evaluated in the intended order.
The appearance of sequential field names (category_id, category_id2, category_id3, ...) is a symptom of a poorly designed schema. Tables should not expand horizontally (by adding columns), they should expand only vertically (by adding rows). If you find yourself adding columns that are related such that they can be named sequentially, consider creating a separate table.
It appears that you have a coupon entity and a category entity. If coupons can belong to multiple categories and categories can contain multiple coupons, the coupons and categories are said to have a many-to-many relationship. Supposing that two tables already exist for coupons and categories, a third table (coupon_category) is needed for the relationship.