SELECT 
  SQL_CALC_FOUND_ROWS products.product_id, 
  descr1.product as product, 
  companies.company as company_name, 
  products.product_type, 
  products.parent_product_id 
FROM 
  q_products as products 
  LEFT JOIN q_product_options_inventory as inventory ON inventory.product_id = products.product_id 
  LEFT JOIN q_product_descriptions as descr1 ON descr1.product_id = products.product_id 
  AND descr1.lang_code = 'en' 
  LEFT JOIN q_product_prices as prices ON prices.product_id = products.product_id 
  AND prices.lower_limit = 1 
  LEFT JOIN q_companies AS companies ON companies.company_id = products.company_id 
  INNER JOIN q_products_categories as products_categories ON products_categories.product_id = products.product_id 
  INNER JOIN q_categories ON q_categories.category_id = products_categories.category_id 
  AND (
    q_categories.usergroup_ids = '' 
    OR FIND_IN_SET(0, q_categories.usergroup_ids) 
    OR FIND_IN_SET(1, q_categories.usergroup_ids)
  ) 
  AND q_categories.status IN ('A', 'H') 
WHERE 
  1 
  AND q_categories.category_id IN (
    168, 169, 170, 171, 172, 173, 174, 175, 
    176, 177, 179, 180, 181, 182, 183, 188, 
    244, 481, 518, 521, 522, 529, 531
  ) 
  AND companies.status = 'A' 
  AND products.company_id = 21 
  AND (
    CASE products.tracking WHEN 'O' THEN inventory.amount > 0 WHEN 'B' THEN products.amount > 0 ELSE 1 END
  ) 
  AND (
    products.usergroup_ids = '' 
    OR FIND_IN_SET(0, products.usergroup_ids) 
    OR FIND_IN_SET(1, products.usergroup_ids)
  ) 
  AND products.status IN ('A') 
  AND prices.usergroup_id IN (0, 0, 1) 
  AND products.company_id = 21 
  AND products.parent_product_id = 0 
GROUP BY 
  products.product_id 
ORDER BY 
  products.timestamp desc, 
  products.product_id ASC 
LIMIT 
  0, 30

Query time 0.00588

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "361.77"
    },
    "ordering_operation": {
      "using_filesort": true,
      "grouping_operation": {
        "using_temporary_table": true,
        "using_filesort": false,
        "nested_loop": [
          {
            "table": {
              "table_name": "inventory",
              "access_type": "system",
              "possible_keys": [
                "pc"
              ],
              "rows_examined_per_scan": 0,
              "rows_produced_per_join": 1,
              "filtered": "0.00",
              "const_row_not_found": true,
              "cost_info": {
                "read_cost": "0.00",
                "eval_cost": "0.20",
                "prefix_cost": "0.00",
                "data_read_per_join": "976"
              },
              "used_columns": [
                "product_id",
                "amount"
              ]
            }
          },
          {
            "table": {
              "table_name": "companies",
              "access_type": "const",
              "possible_keys": [
                "PRIMARY"
              ],
              "key": "PRIMARY",
              "used_key_parts": [
                "company_id"
              ],
              "key_length": "4",
              "ref": [
                "const"
              ],
              "rows_examined_per_scan": 1,
              "rows_produced_per_join": 1,
              "filtered": "100.00",
              "cost_info": {
                "read_cost": "0.00",
                "eval_cost": "0.20",
                "prefix_cost": "0.00",
                "data_read_per_join": "5K"
              },
              "used_columns": [
                "company_id",
                "status",
                "company"
              ]
            }
          },
          {
            "table": {
              "table_name": "products_categories",
              "access_type": "range",
              "possible_keys": [
                "PRIMARY",
                "pt"
              ],
              "key": "PRIMARY",
              "used_key_parts": [
                "category_id"
              ],
              "key_length": "3",
              "rows_examined_per_scan": 523,
              "rows_produced_per_join": 523,
              "filtered": "100.00",
              "using_index": true,
              "cost_info": {
                "read_cost": "118.66",
                "eval_cost": "104.60",
                "prefix_cost": "223.26",
                "data_read_per_join": "8K"
              },
              "used_columns": [
                "product_id",
                "category_id"
              ],
              "attached_condition": "(`portal`.`products_categories`.`category_id` in (168,169,170,171,172,173,174,175,176,177,179,180,181,182,183,188,244,481,518,521,522,529,531))"
            }
          },
          {
            "table": {
              "table_name": "q_categories",
              "access_type": "eq_ref",
              "possible_keys": [
                "PRIMARY",
                "c_status",
                "p_category_id"
              ],
              "key": "PRIMARY",
              "used_key_parts": [
                "category_id"
              ],
              "key_length": "3",
              "ref": [
                "portal.products_categories.category_id"
              ],
              "rows_examined_per_scan": 1,
              "rows_produced_per_join": 104,
              "filtered": "20.00",
              "cost_info": {
                "read_cost": "0.00",
                "eval_cost": "20.92",
                "prefix_cost": "327.86",
                "data_read_per_join": "276K"
              },
              "used_columns": [
                "category_id",
                "usergroup_ids",
                "status"
              ],
              "attached_condition": "(((`portal`.`q_categories`.`usergroup_ids` = '') or find_in_set(0,`portal`.`q_categories`.`usergroup_ids`) or find_in_set(1,`portal`.`q_categories`.`usergroup_ids`)) and (`portal`.`q_categories`.`status` in ('A','H')))"
            }
          },
          {
            "table": {
              "table_name": "products",
              "access_type": "eq_ref",
              "possible_keys": [
                "PRIMARY",
                "status",
                "idx_parent_product_id"
              ],
              "key": "PRIMARY",
              "used_key_parts": [
                "product_id"
              ],
              "key_length": "3",
              "ref": [
                "portal.products_categories.product_id"
              ],
              "rows_examined_per_scan": 1,
              "rows_produced_per_join": 9,
              "filtered": "8.87",
              "cost_info": {
                "read_cost": "0.00",
                "eval_cost": "1.86",
                "prefix_cost": "348.78",
                "data_read_per_join": "54K"
              },
              "used_columns": [
                "product_id",
                "product_type",
                "status",
                "company_id",
                "amount",
                "timestamp",
                "usergroup_ids",
                "tracking",
                "parent_product_id"
              ],
              "attached_condition": "((`portal`.`products`.`parent_product_id` = 0) and (`portal`.`products`.`company_id` = 21) and (case `portal`.`products`.`tracking` when 'O' then <cache>((NULL > 0)) when 'B' then (`portal`.`products`.`amount` > 0) else 1 end) and ((`portal`.`products`.`usergroup_ids` = '') or find_in_set(0,`portal`.`products`.`usergroup_ids`) or find_in_set(1,`portal`.`products`.`usergroup_ids`)) and (`portal`.`products`.`status` = 'A'))"
            }
          },
          {
            "table": {
              "table_name": "descr1",
              "access_type": "eq_ref",
              "possible_keys": [
                "PRIMARY",
                "product_id"
              ],
              "key": "PRIMARY",
              "used_key_parts": [
                "product_id",
                "lang_code"
              ],
              "key_length": "9",
              "ref": [
                "portal.products_categories.product_id",
                "const"
              ],
              "rows_examined_per_scan": 1,
              "rows_produced_per_join": 9,
              "filtered": "100.00",
              "cost_info": {
                "read_cost": "0.00",
                "eval_cost": "1.86",
                "prefix_cost": "350.64",
                "data_read_per_join": "35K"
              },
              "used_columns": [
                "product_id",
                "lang_code",
                "product"
              ]
            }
          },
          {
            "table": {
              "table_name": "prices",
              "access_type": "ref",
              "possible_keys": [
                "usergroup",
                "product_id",
                "lower_limit",
                "usergroup_id"
              ],
              "key": "usergroup",
              "used_key_parts": [
                "product_id"
              ],
              "key_length": "3",
              "ref": [
                "portal.products_categories.product_id"
              ],
              "rows_examined_per_scan": 1,
              "rows_produced_per_join": 9,
              "filtered": "99.95",
              "using_index": true,
              "cost_info": {
                "read_cost": "9.28",
                "eval_cost": "1.85",
                "prefix_cost": "361.77",
                "data_read_per_join": "222"
              },
              "used_columns": [
                "product_id",
                "lower_limit",
                "usergroup_id"
              ],
              "attached_condition": "((`portal`.`prices`.`lower_limit` = 1) and (`portal`.`prices`.`usergroup_id` in (0,0,1)))"
            }
          }
        ]
      }
    }
  }
}

Result

product_id product company_name product_type parent_product_id
29282 Vacuum Space Saver Reusable Sealer Storage Bags 70 X100 Cm, Pack Of 7, With Suction Pump J D F General Trading LLC P 0
29283 Digital Multi-Function Food Kitchen Scale,11 Lb/5 Kg Digital Multifunction Stainless Steel Kitchen Food Scale J D F General Trading LLC P 0
29314 Sundix 2 Pack Square And Ball Ice Cube Tray Black J D F General Trading LLC P 0
29341 6 Pcs 750 Ml Stainless Steel Cocktail Shaker Mixer J D F General Trading LLC P 0
29690 Silicone Ice Cream Mould Popsicle Mold Ice Tray Puck Popsicle Frozen Mold Shape Diy Ice Cream Tools, Pink J D F General Trading LLC P 0
29694 Black 8 Big Cube Giant Jumbo Large Silicone Ice Cube Square Tray Mold Mould J D F General Trading LLC P 0
29702 Mini 2 Gear Speed USB Fan Computer Portable Mute Usb Charge Cooling Fan Desk Laptop Fan Sslp91 Black J D F General Trading LLC P 0
29799 Silent Electric Ultraviolet Mosquito Fly Bug Insect - Black J D F General Trading LLC P 0
30319 Non-Stick Grilling Mats, Use on Gas Grills, Charcoal or Electric Barbecues J D F General Trading LLC P 0
30339 Usb Electronic Mosquito Trap Lamp Fly Repellent UV Radiation Photocatalyst Insect Killer J D F General Trading LLC P 0
30770 Lazy Neck Hanging Style Dual Cooling Fan - Portable with Usb Rechargeable Neckband Battery Operated Quiet for Office Room J D F General Trading LLC P 0
30781 Kitchen Bathroom Wall Storage Shelf Hanging Rack Corner Basket Holder Organizer J D F General Trading LLC P 0
30782 5 Pcs Disposable Fly Trap Catcher Fly Catcher Insect Trap Hanging Style Pest Control J D F General Trading LLC P 0
30783 A Pair Refrigerator Handle Cover Kitchen Appliance Refrigerator Cover J D F General Trading LLC P 0
30787 Kitchen Tap Single Lever Mixer Faucet Sink Mixer with Pullout Spray J D F General Trading LLC P 0
30794 Electronic Mosquito Killer Lamp Insect Bug J D F General Trading LLC P 0
30799 Silicone Chocolate Fondant Cake Decorating Round Pearls Bubbles Mold Mold J D F General Trading LLC P 0
30815 Solar Powered Portable Electric Mosquito Lamp Mosquito Killer Lamps Solar Bug Za J D F General Trading LLC P 0
30860 New Kitchen Electric Hand Whisk Mixer Coffee, Milk and Egg Beater Stainless Steel J D F General Trading LLC P 0
30873 3 Pcs Piping Flower Scissors + Nail Icing Bake Cake Decorating Cupcake Pastry Tools J D F General Trading LLC P 0
30876 Wine Bottle Saver Vacuum Stoppers Preserver Saver Vacu Vin Set of 4 J D F General Trading LLC P 0
30899 Faucet Extender Sink Handle Extension Toddler Kid Bathroom Children Hand Wash J D F General Trading LLC P 0
30911 Household Waterproof Microwave Oven Dust Cover with Storage Bag for Kitchen B J D F General Trading LLC P 0
30920 2 Pc Kitchen Refrigerator Space Saver Organizer Slide Shelf Rack Rack Storage J D F General Trading LLC P 0
30931 Stainless Steel Core Seed Remover Fruit Apple Pear Corer Easy Twist Kitchen Tool J D F General Trading LLC P 0
30937 Metal Hanging Garbage Bags Rack Kitchen Wash Cloth Towel Storage Shelf J D F General Trading LLC P 0
30939 New Automatic Cockroach House Insects Bugs Capture Bait Trap Killer Catcher Box J D F General Trading LLC P 0
30943 Double Sided 600/1500 Grit Honing Sharpener Sharpening Stone Whetstone J D F General Trading LLC P 0
30957 C 'est La Vie Collection of Rabbit Ear Manual Bottle Opener J D F General Trading LLC P 0
30972 For Dyson Vacuum Cleaner Accessories Adapter V6 Converted to V7 V8 V10 Interface J D F General Trading LLC P 0