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 (
    10991, 10992, 11025, 11024, 11081, 11080, 
    11082, 11086, 11085, 11137, 11136, 
    11152, 11153, 11236, 11237, 11300, 
    11301, 11306, 11307, 11337, 11338, 
    11348, 11349, 11352, 11355, 11360, 
    11361, 11362, 11363, 11364, 11365, 
    11388, 11389, 11390, 11391, 11399, 
    11400, 11411, 11412, 11413, 11416, 
    11415, 11414, 11417, 11430, 11431, 
    11439, 11441, 11445, 11446, 11447, 
    11448, 11453, 11454, 11455, 11458, 
    11460, 11462, 11463, 11472, 11474, 
    11475, 11477, 11478, 11480, 11479, 
    11481, 11508, 11509, 11520, 11521, 
    11522, 11523, 11530, 11532, 11531, 
    11533, 11534, 11535, 11536, 11598, 
    11599, 11600, 11633, 11634, 11635, 
    11636
  ) 
GROUP BY 
  cscart_products_categories.product_id

Query time 0.00217

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "562.56"
    },
    "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": 676,
            "rows_produced_per_join": 676,
            "filtered": "100.00",
            "index_condition": "(`softwarepirmam_hewadelivard_cscart_4`.`cscart_products_categories`.`product_id` in (10991,10992,11025,11024,11081,11080,11082,11086,11085,11137,11136,11152,11153,11236,11237,11300,11301,11306,11307,11337,11338,11348,11349,11352,11355,11360,11361,11362,11363,11364,11365,11388,11389,11390,11391,11399,11400,11411,11412,11413,11416,11415,11414,11417,11430,11431,11439,11441,11445,11446,11447,11448,11453,11454,11455,11458,11460,11462,11463,11472,11474,11475,11477,11478,11480,11479,11481,11508,11509,11520,11521,11522,11523,11530,11532,11531,11533,11534,11535,11536,11598,11599,11600,11633,11634,11635,11636))",
            "cost_info": {
              "read_cost": "258.36",
              "eval_cost": "67.60",
              "prefix_cost": "325.96",
              "data_read_per_join": "10K"
            },
            "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": 33,
            "filtered": "5.00",
            "cost_info": {
              "read_cost": "169.00",
              "eval_cost": "3.38",
              "prefix_cost": "562.56",
              "data_read_per_join": "105K"
            },
            "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
10991 664M
10992 664M
11024 664M
11025 664M
11080 664M
11081 664M
11082 664M
11085 664M
11086 664M
11136 664M
11137 664M
11152 664M
11153 664M
11236 664M
11237 664M
11300 664M
11301 664M
11306 664M
11307 664M
11337 664M
11338 664M
11348 664M
11349 664M
11352 664M
11355 664M
11360 664M
11361 664M
11362 664M
11363 664M
11364 664M
11365 664M
11388 664M
11389 664M
11390 664M
11391 664M
11399 664M
11400 664M
11411 664M
11412 664M
11413 664M
11414 664M
11415 664M
11416 664M
11417 664M
11430 664M
11431 664M
11439 664M
11441 664M
11445 664M
11446 664M
11447 664M
11448 664M
11453 664M
11454 664M
11455 664M
11458 664M
11460 664M
11462 664M
11463 664M
11472 664M
11474 664M
11475 664M
11477 664M
11478 664M
11479 664M
11480 664M
11481 664M
11508 664M
11509 664M
11520 664M
11521 664M
11522 664M
11523 664M
11530 664M
11531 664M
11532 664M
11533 664M
11534 664M
11535 664M
11536 664M
11598 664M
11599 664M
11600 664M
11633 664M
11634 664M
11635 664M
11636 664M