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.status IN ('A', 'H') 
WHERE 
  cscart_products_categories.product_id IN (
    69361, 69045, 69036, 39005, 37892, 38063, 
    66499, 69383, 66516, 69046, 66500, 
    69380, 66501, 37893, 66504, 69803, 
    67439, 66503, 66517, 66508, 69820, 
    66513, 69817, 69814
  ) 
GROUP BY 
  cscart_products_categories.product_id

Query time 0.00113

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "26.84"
    },
    "grouping_operation": {
      "using_filesort": false,
      "nested_loop": [
        {
          "table": {
            "table_name": "cscart_products_categories",
            "access_type": "range",
            "possible_keys": [
              "PRIMARY",
              "link_type",
              "pt",
              "idx_product_category_lookup",
              "idx_products_categories_composite"
            ],
            "key": "idx_products_categories_composite",
            "used_key_parts": [
              "product_id"
            ],
            "key_length": "3",
            "rows_examined_per_scan": 48,
            "rows_produced_per_join": 48,
            "filtered": "100.00",
            "using_index": true,
            "cost_info": {
              "read_cost": "5.24",
              "eval_cost": "4.80",
              "prefix_cost": "10.04",
              "data_read_per_join": "768"
            },
            "used_columns": [
              "product_id",
              "category_id",
              "link_type"
            ],
            "attached_condition": "(`cscart_db`.`cscart_products_categories`.`product_id` in (69361,69045,69036,39005,37892,38063,66499,69383,66516,69046,66500,69380,66501,37893,66504,69803,67439,66503,66517,66508,69820,66513,69817,69814))"
          }
        },
        {
          "table": {
            "table_name": "cscart_categories",
            "access_type": "eq_ref",
            "possible_keys": [
              "PRIMARY",
              "p_category_id",
              "idx_categories_storefront_status",
              "idx_categories_usergroup_status",
              "idx_categories_status_id_path"
            ],
            "key": "PRIMARY",
            "used_key_parts": [
              "category_id"
            ],
            "key_length": "3",
            "ref": [
              "cscart_db.cscart_products_categories.category_id"
            ],
            "rows_examined_per_scan": 1,
            "rows_produced_per_join": 39,
            "filtered": "81.96",
            "cost_info": {
              "read_cost": "12.00",
              "eval_cost": "3.93",
              "prefix_cost": "26.84",
              "data_read_per_join": "110K"
            },
            "used_columns": [
              "category_id",
              "status",
              "storefront_id"
            ],
            "attached_condition": "((`cscart_db`.`cscart_categories`.`storefront_id` in (0,1)) and (`cscart_db`.`cscart_categories`.`status` in ('A','H')))"
          }
        }
      ]
    }
  }
}

Result

product_id category_ids
37892 2331,2831M
37893 2331,2831M
38063 2331,2831M
39005 2695M,3128
66499 2331,2831M
66500 2331,2831M
66501 2331,2831M
66503 2331,2831M
66504 2331,2831M
66508 2331,2831M
66513 2331,2831M
66516 2331,2831M
66517 2331M,2831
67439 2331,2831M
69036 2331,2831M
69045 2331,2831M
69046 2331,2831M
69361 2327,2811M
69380 2330,2732M
69383 2331,2828M
69803 2331,2831M
69814 2327,2811M
69817 2334,2695M
69820 2334,2695M