SELECT 
  products.company_id, 
  COUNT(DISTINCT products.product_id) as products_count 
FROM 
  cscart_products as products 
  LEFT JOIN cscart_product_descriptions as descr1 ON descr1.product_id = products.product_id 
  AND descr1.lang_code = 'en' 
  LEFT JOIN cscart_product_prices as prices ON prices.product_id = products.product_id 
  AND prices.lower_limit = 1 
  LEFT JOIN cscart_companies AS companies ON companies.company_id = products.company_id 
  INNER JOIN cscart_products_categories as products_categories ON products_categories.product_id = products.product_id 
  INNER JOIN cscart_categories ON cscart_categories.category_id = products_categories.category_id 
  AND (
    cscart_categories.usergroup_ids = '' 
    OR FIND_IN_SET(
      0, cscart_categories.usergroup_ids
    ) 
    OR FIND_IN_SET(
      1, cscart_categories.usergroup_ids
    )
  ) 
  AND cscart_categories.status IN ('A', 'H') 
  AND cscart_categories.storefront_id IN (0, 1) 
WHERE 
  1 = 1 
  AND companies.status IN ('A') 
  AND products.status IN ('A') 
  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.parent_product_id = 0 
  AND products.product_type != 'D' 
  AND products.company_id IN (2, 1, 3) 
GROUP BY 
  products.company_id

Query time 0.00384

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "42.84"
    },
    "grouping_operation": {
      "using_temporary_table": true,
      "using_filesort": true,
      "cost_info": {
        "sort_cost": "0.76"
      },
      "nested_loop": [
        {
          "table": {
            "table_name": "companies",
            "access_type": "ALL",
            "possible_keys": [
              "PRIMARY"
            ],
            "rows_examined_per_scan": 3,
            "rows_produced_per_join": 1,
            "filtered": "33.33",
            "cost_info": {
              "read_cost": "2.51",
              "eval_cost": "0.20",
              "prefix_cost": "2.71",
              "data_read_per_join": "7K"
            },
            "used_columns": [
              "company_id",
              "status"
            ],
            "attached_condition": "((`danishecarter_25_march`.`companies`.`status` = 'A') and (`danishecarter_25_march`.`companies`.`company_id` in (2,1,3)))"
          }
        },
        {
          "table": {
            "table_name": "cscart_categories",
            "access_type": "ALL",
            "possible_keys": [
              "PRIMARY",
              "c_status",
              "p_category_id"
            ],
            "rows_examined_per_scan": 98,
            "rows_produced_per_join": 3,
            "filtered": "4.00",
            "using_join_buffer": "Block Nested Loop",
            "cost_info": {
              "read_cost": "22.48",
              "eval_cost": "0.78",
              "prefix_cost": "25.98",
              "data_read_per_join": "13K"
            },
            "used_columns": [
              "category_id",
              "storefront_id",
              "usergroup_ids",
              "status"
            ],
            "attached_condition": "(((`danishecarter_25_march`.`cscart_categories`.`usergroup_ids` = '') or find_in_set(0,`danishecarter_25_march`.`cscart_categories`.`usergroup_ids`) or find_in_set(1,`danishecarter_25_march`.`cscart_categories`.`usergroup_ids`)) and (`danishecarter_25_march`.`cscart_categories`.`status` in ('A','H')) and (`danishecarter_25_march`.`cscart_categories`.`storefront_id` in (0,1)))"
          }
        },
        {
          "table": {
            "table_name": "products_categories",
            "access_type": "ref",
            "possible_keys": [
              "PRIMARY",
              "pt"
            ],
            "key": "PRIMARY",
            "used_key_parts": [
              "category_id"
            ],
            "key_length": "3",
            "ref": [
              "danishecarter_25_march.cscart_categories.category_id"
            ],
            "rows_examined_per_scan": 2,
            "rows_produced_per_join": 7,
            "filtered": "100.00",
            "using_index": true,
            "cost_info": {
              "read_cost": "4.09",
              "eval_cost": "1.57",
              "prefix_cost": "31.64",
              "data_read_per_join": "125"
            },
            "used_columns": [
              "product_id",
              "category_id"
            ]
          }
        },
        {
          "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": [
              "danishecarter_25_march.products_categories.product_id"
            ],
            "rows_examined_per_scan": 1,
            "rows_produced_per_join": 0,
            "filtered": "5.00",
            "cost_info": {
              "read_cost": "7.84",
              "eval_cost": "0.08",
              "prefix_cost": "41.04",
              "data_read_per_join": "1K"
            },
            "used_columns": [
              "product_id",
              "product_type",
              "status",
              "company_id",
              "usergroup_ids",
              "parent_product_id"
            ],
            "attached_condition": "((`danishecarter_25_march`.`products`.`company_id` = `danishecarter_25_march`.`companies`.`company_id`) and (`danishecarter_25_march`.`products`.`parent_product_id` = 0) and (`danishecarter_25_march`.`products`.`status` = 'A') and ((`danishecarter_25_march`.`products`.`usergroup_ids` = '') or find_in_set(0,`danishecarter_25_march`.`products`.`usergroup_ids`) or find_in_set(1,`danishecarter_25_march`.`products`.`usergroup_ids`)) and (`danishecarter_25_march`.`products`.`product_type` <> 'D'))"
          }
        },
        {
          "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": [
              "danishecarter_25_march.products_categories.product_id",
              "const"
            ],
            "rows_examined_per_scan": 1,
            "rows_produced_per_join": 0,
            "filtered": "100.00",
            "using_index": true,
            "cost_info": {
              "read_cost": "0.39",
              "eval_cost": "0.08",
              "prefix_cost": "41.51",
              "data_read_per_join": "1K"
            },
            "used_columns": [
              "product_id",
              "lang_code"
            ]
          }
        },
        {
          "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": [
              "danishecarter_25_march.products_categories.product_id"
            ],
            "rows_examined_per_scan": 2,
            "rows_produced_per_join": 0,
            "filtered": "96.58",
            "using_index": true,
            "cost_info": {
              "read_cost": "0.41",
              "eval_cost": "0.15",
              "prefix_cost": "42.08",
              "data_read_per_join": "18"
            },
            "used_columns": [
              "product_id",
              "lower_limit",
              "usergroup_id"
            ],
            "attached_condition": "((`danishecarter_25_march`.`prices`.`lower_limit` = 1) and (`danishecarter_25_march`.`prices`.`usergroup_id` in (0,0,1)))"
          }
        }
      ]
    }
  }
}

Result

company_id products_count
1 241
2 7
3 3