SELECT 
  cscart_products_categories.product_id, 
  GROUP_CONCAT(
    IF(
      cscart_products_categories.link_type = "M", 
      CONCAT(
        cscart_products_categories.category_id, 
        "M"
      ), 
      cscart_products_categories.category_id
    )
  ) AS category_ids 
FROM 
  cscart_products_categories 
  INNER JOIN cscart_categories ON cscart_categories.category_id = cscart_products_categories.category_id 
  AND cscart_categories.storefront_id IN (0, 1) 
  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') 
WHERE 
  cscart_products_categories.product_id IN (
    11013, 11011, 11015, 11014, 11016, 11228, 
    11229, 11330, 11331, 11332, 11333, 
    11334, 11335, 11373, 11376, 11401, 
    11402, 11403, 11404, 11405, 11432, 
    11433, 11459, 11461, 11464, 11466, 
    11468, 11482, 11483, 11484, 11485, 
    11486, 11496, 11497, 11498, 11499, 
    11501, 11502, 11503, 11504, 11511, 
    11512, 11513, 11540, 11541, 11544, 
    11545, 11546, 11547, 11548, 11549, 
    11554, 11556, 11557, 11558, 11568, 
    11569
  ) 
GROUP BY 
  cscart_products_categories.product_id

Query time 0.00130

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "386.26"
    },
    "grouping_operation": {
      "using_filesort": false,
      "nested_loop": [
        {
          "table": {
            "table_name": "cscart_products_categories",
            "access_type": "range",
            "possible_keys": [
              "PRIMARY",
              "pt"
            ],
            "key": "pt",
            "used_key_parts": [
              "product_id"
            ],
            "key_length": "3",
            "rows_examined_per_scan": 465,
            "rows_produced_per_join": 465,
            "filtered": "100.00",
            "index_condition": "(`softwarepirmam_hewadelivard_cscart_4`.`cscart_products_categories`.`product_id` in (11013,11011,11015,11014,11016,11228,11229,11330,11331,11332,11333,11334,11335,11373,11376,11401,11402,11403,11404,11405,11432,11433,11459,11461,11464,11466,11468,11482,11483,11484,11485,11486,11496,11497,11498,11499,11501,11502,11503,11504,11511,11512,11513,11540,11541,11544,11545,11546,11547,11548,11549,11554,11556,11557,11558,11568,11569))",
            "cost_info": {
              "read_cost": "177.01",
              "eval_cost": "46.50",
              "prefix_cost": "223.51",
              "data_read_per_join": "7K"
            },
            "used_columns": [
              "product_id",
              "category_id",
              "link_type"
            ]
          }
        },
        {
          "table": {
            "table_name": "cscart_categories",
            "access_type": "eq_ref",
            "possible_keys": [
              "PRIMARY",
              "c_status",
              "p_category_id"
            ],
            "key": "PRIMARY",
            "used_key_parts": [
              "category_id"
            ],
            "key_length": "3",
            "ref": [
              "softwarepirmam_hewadelivard_cscart_4.cscart_products_categories.category_id"
            ],
            "rows_examined_per_scan": 1,
            "rows_produced_per_join": 23,
            "filtered": "5.00",
            "cost_info": {
              "read_cost": "116.25",
              "eval_cost": "2.33",
              "prefix_cost": "386.26",
              "data_read_per_join": "72K"
            },
            "used_columns": [
              "category_id",
              "storefront_id",
              "usergroup_ids",
              "status"
            ],
            "attached_condition": "((`softwarepirmam_hewadelivard_cscart_4`.`cscart_categories`.`storefront_id` in (0,1)) and ((`softwarepirmam_hewadelivard_cscart_4`.`cscart_categories`.`usergroup_ids` = '') or (0 <> find_in_set(0,`softwarepirmam_hewadelivard_cscart_4`.`cscart_categories`.`usergroup_ids`)) or (0 <> find_in_set(1,`softwarepirmam_hewadelivard_cscart_4`.`cscart_categories`.`usergroup_ids`))) and (`softwarepirmam_hewadelivard_cscart_4`.`cscart_categories`.`status` in ('A','H')))"
          }
        }
      ]
    }
  }
}

Result

product_id category_ids
11011 664M
11013 664M
11014 664M
11015 664M
11016 664M
11228 664M
11229 664M
11330 664M
11331 664M
11332 664M
11333 664M
11334 664M
11335 664M
11373 664M
11376 664M
11401 664M
11402 664M
11403 664M
11404 664M
11405 664M
11432 664M
11433 664M
11459 664M
11461 664M
11464 664M
11466 664M
11468 664M
11482 664M
11483 664M
11484 664M
11485 664M
11486 664M
11496 664M
11497 664M
11498 664M
11499 664M
11501 664M
11502 664M
11503 664M
11504 664M
11511 664M
11512 664M
11513 664M
11540 664M
11541 664M
11544 664M
11545 664M
11546 664M
11547 664M
11548 664M
11549 664M
11554 664M
11556 664M
11557 664M
11558 664M
11568 664M
11569 664M