SELECT 
  SQL_CALC_FOUND_ROWS products.product_id, 
  descr1.product as product, 
  companies.company as company_name, 
  companies.ag_hide_city as company_city_hide, 
  companies.city as company_city, 
  companies.state as company_state 
FROM 
  products as products 
  LEFT JOIN product_descriptions as descr1 ON descr1.product_id = products.product_id 
  AND descr1.lang_code = 'en' 
  LEFT JOIN product_prices as prices ON prices.product_id = products.product_id 
  AND prices.lower_limit = 1 
  LEFT JOIN companies AS companies ON companies.company_id = products.company_id 
  INNER JOIN products_categories as products_categories ON products_categories.product_id = products.product_id 
  INNER JOIN categories ON categories.category_id = products_categories.category_id 
  AND (
    categories.usergroup_ids = '' 
    OR FIND_IN_SET(0, categories.usergroup_ids) 
    OR FIND_IN_SET(1, categories.usergroup_ids)
  ) 
  AND categories.status IN ('A', 'H') 
  AND categories.storefront_id IN (0, 1) 
  LEFT JOIN product_options_inventory as inventory ON inventory.product_id = products.product_id 
  LEFT JOIN product_popularity as popularity ON popularity.product_id = products.product_id 
WHERE 
  1 
  AND products.product_id NOT IN (323389) 
  AND companies.status IN ('A') 
  AND products.company_id = 334 
  AND (
    products.amount > 0 
    OR products.tracking = 'D'
  ) 
  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 = 334 
GROUP BY 
  products.product_id 
ORDER BY 
  popularity.total desc, 
  products.product_id ASC 
LIMIT 
  0, 4

Query time 0.15866

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "3003.71"
    },
    "ordering_operation": {
      "using_temporary_table": true,
      "using_filesort": true,
      "grouping_operation": {
        "using_filesort": false,
        "nested_loop": [
          {
            "table": {
              "table_name": "companies",
              "access_type": "const",
              "possible_keys": [
                "PRIMARY",
                "idx_status"
              ],
              "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.10",
                "prefix_cost": "0.00",
                "data_read_per_join": "14K"
              },
              "used_columns": [
                "company_id",
                "status",
                "company",
                "city",
                "state",
                "ag_hide_city"
              ]
            }
          },
          {
            "table": {
              "table_name": "products",
              "access_type": "range",
              "possible_keys": [
                "PRIMARY",
                "age_verification",
                "status",
                "idx_company_id",
                "idx_usergroup_ids",
                "idx_amount",
                "index_products_on_deleted_at"
              ],
              "key": "idx_company_id",
              "used_key_parts": [
                "company_id",
                "product_id"
              ],
              "key_length": "7",
              "rows_examined_per_scan": 6320,
              "rows_produced_per_join": 252,
              "filtered": "4.00",
              "index_condition": "((`goimagine`.`products`.`company_id` = 334) and (`goimagine`.`products`.`product_id` <> 323389))",
              "cost_info": {
                "read_cost": "2819.23",
                "eval_cost": "25.28",
                "prefix_cost": "2844.51",
                "data_read_per_join": "1M"
              },
              "used_columns": [
                "product_id",
                "status",
                "company_id",
                "amount",
                "usergroup_ids",
                "tracking"
              ],
              "attached_condition": "(((`goimagine`.`products`.`amount` > 0) or (`goimagine`.`products`.`tracking` = 'D')) and ((`goimagine`.`products`.`usergroup_ids` = '') or (0 <> find_in_set(0,`goimagine`.`products`.`usergroup_ids`)) or (0 <> find_in_set(1,`goimagine`.`products`.`usergroup_ids`))) and (`goimagine`.`products`.`status` = 'A'))"
            }
          },
          {
            "table": {
              "table_name": "prices",
              "access_type": "ref",
              "possible_keys": [
                "usergroup",
                "product_id",
                "lower_limit",
                "usergroup_id"
              ],
              "key": "product_id",
              "used_key_parts": [
                "product_id"
              ],
              "key_length": "3",
              "ref": [
                "goimagine.products.product_id"
              ],
              "rows_examined_per_scan": 1,
              "rows_produced_per_join": 39,
              "filtered": "15.00",
              "cost_info": {
                "read_cost": "81.68",
                "eval_cost": "3.93",
                "prefix_cost": "2952.38",
                "data_read_per_join": "942"
              },
              "used_columns": [
                "id",
                "product_id",
                "lower_limit",
                "usergroup_id"
              ],
              "attached_condition": "((`goimagine`.`prices`.`lower_limit` = 1) and (`goimagine`.`prices`.`usergroup_id` in (0,0,1)))"
            }
          },
          {
            "table": {
              "table_name": "products_categories",
              "access_type": "ref",
              "possible_keys": [
                "PRIMARY",
                "pt"
              ],
              "key": "pt",
              "used_key_parts": [
                "product_id"
              ],
              "key_length": "3",
              "ref": [
                "goimagine.products.product_id"
              ],
              "rows_examined_per_scan": 1,
              "rows_produced_per_join": 75,
              "filtered": "100.00",
              "using_index": true,
              "cost_info": {
                "read_cost": "11.64",
                "eval_cost": "7.51",
                "prefix_cost": "2971.53",
                "data_read_per_join": "1K"
              },
              "used_columns": [
                "product_id",
                "category_id"
              ]
            }
          },
          {
            "table": {
              "table_name": "categories",
              "access_type": "eq_ref",
              "possible_keys": [
                "PRIMARY",
                "c_status",
                "p_category_id"
              ],
              "key": "PRIMARY",
              "used_key_parts": [
                "category_id"
              ],
              "key_length": "3",
              "ref": [
                "goimagine.products_categories.category_id"
              ],
              "rows_examined_per_scan": 1,
              "rows_produced_per_join": 3,
              "filtered": "5.00",
              "cost_info": {
                "read_cost": "18.78",
                "eval_cost": "0.38",
                "prefix_cost": "2997.82",
                "data_read_per_join": "9K"
              },
              "used_columns": [
                "category_id",
                "usergroup_ids",
                "status",
                "storefront_id"
              ],
              "attached_condition": "(((`goimagine`.`categories`.`usergroup_ids` = '') or (0 <> find_in_set(0,`goimagine`.`categories`.`usergroup_ids`)) or (0 <> find_in_set(1,`goimagine`.`categories`.`usergroup_ids`))) and (`goimagine`.`categories`.`status` in ('A','H')) and (`goimagine`.`categories`.`storefront_id` in (0,1)))"
            }
          },
          {
            "table": {
              "table_name": "descr1",
              "access_type": "eq_ref",
              "possible_keys": [
                "PRIMARY",
                "product_id"
              ],
              "key": "PRIMARY",
              "used_key_parts": [
                "product_id",
                "lang_code"
              ],
              "key_length": "11",
              "ref": [
                "goimagine.products.product_id",
                "const"
              ],
              "rows_examined_per_scan": 1,
              "rows_produced_per_join": 3,
              "filtered": "100.00",
              "cost_info": {
                "read_cost": "1.26",
                "eval_cost": "0.38",
                "prefix_cost": "2999.45",
                "data_read_per_join": "19K"
              },
              "used_columns": [
                "product_id",
                "lang_code",
                "product"
              ]
            }
          },
          {
            "table": {
              "table_name": "inventory",
              "access_type": "ref",
              "possible_keys": [
                "pc"
              ],
              "key": "pc",
              "used_key_parts": [
                "product_id"
              ],
              "key_length": "3",
              "ref": [
                "goimagine.products.product_id"
              ],
              "rows_examined_per_scan": 3,
              "rows_produced_per_join": 12,
              "filtered": "100.00",
              "using_index": true,
              "cost_info": {
                "read_cost": "1.14",
                "eval_cost": "1.28",
                "prefix_cost": "3001.87",
                "data_read_per_join": "12K"
              },
              "used_columns": [
                "product_id",
                "combination_hash"
              ]
            }
          },
          {
            "table": {
              "table_name": "popularity",
              "access_type": "eq_ref",
              "possible_keys": [
                "PRIMARY",
                "total"
              ],
              "key": "PRIMARY",
              "used_key_parts": [
                "product_id"
              ],
              "key_length": "3",
              "ref": [
                "goimagine.products.product_id"
              ],
              "rows_examined_per_scan": 1,
              "rows_produced_per_join": 12,
              "filtered": "100.00",
              "cost_info": {
                "read_cost": "0.57",
                "eval_cost": "1.28",
                "prefix_cost": "3003.71",
                "data_read_per_join": "408"
              },
              "used_columns": [
                "product_id",
                "total"
              ]
            }
          }
        ]
      }
    }
  }
}

Result

product_id product company_name company_city_hide company_city company_state
19002 Baby Duck Ear flap hat, baby duck hat, shower gift, halloween hat, halloween costume hat, hat for babies, photo prop, crocheted hat NWXtreme Kidz N Puyallup WA
19034 White Puppy dog Ear flap hat, baby or toddler puppy hat, dog hat, furry dog hat, Halloween doggy hat NWXtreme Kidz N Puyallup WA
20711 Navy Blue and Neon Green Tutu Dress, Sparkly Princess Dress, Flower Girl Dress, Birthday Outfit, Toddler Tutu Dress, Seattle Tutu NWXtreme Kidz N Puyallup WA
18981 Bernese Mountain dog hat, crocheted furry Bernese dog hat, baby to adult size Bernese dog hat, can make to your specs. So cute! NWXtreme Kidz N Puyallup WA