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.company_id = 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 (
    886, 367, 1144, 894, 895, 1189, 421, 918, 
    891, 327, 326, 1182
  ) 
GROUP BY 
  cscart_products_categories.product_id

Query time 0.00239

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "140.99"
    },
    "grouping_operation": {
      "using_temporary_table": true,
      "using_filesort": true,
      "cost_info": {
        "sort_cost": "2.57"
      },
      "nested_loop": [
        {
          "table": {
            "table_name": "cscart_categories",
            "access_type": "ALL",
            "possible_keys": [
              "PRIMARY",
              "c_status",
              "p_category_id"
            ],
            "rows_examined_per_scan": 115,
            "rows_produced_per_join": 2,
            "filtered": "2.00",
            "cost_info": {
              "read_cost": "27.56",
              "eval_cost": "0.46",
              "prefix_cost": "28.02",
              "data_read_per_join": "6K"
            },
            "used_columns": [
              "category_id",
              "company_id",
              "usergroup_ids",
              "status"
            ],
            "attached_condition": "((`eshopuga_upgr_4122`.`cscart_categories`.`company_id` = 1) and ((`eshopuga_upgr_4122`.`cscart_categories`.`usergroup_ids` = '') or find_in_set(0,`eshopuga_upgr_4122`.`cscart_categories`.`usergroup_ids`) or find_in_set(1,`eshopuga_upgr_4122`.`cscart_categories`.`usergroup_ids`)) and (`eshopuga_upgr_4122`.`cscart_categories`.`status` in ('A','H')))"
          }
        },
        {
          "table": {
            "table_name": "cscart_products_categories",
            "access_type": "ref",
            "possible_keys": [
              "PRIMARY",
              "pt"
            ],
            "key": "PRIMARY",
            "used_key_parts": [
              "category_id"
            ],
            "key_length": "3",
            "ref": [
              "eshopuga_upgr_4122.cscart_categories.category_id"
            ],
            "rows_examined_per_scan": 40,
            "rows_produced_per_join": 2,
            "filtered": "2.79",
            "index_condition": "(`eshopuga_upgr_4122`.`cscart_products_categories`.`product_id` in (886,367,1144,894,895,1189,421,918,891,327,326,1182))",
            "cost_info": {
              "read_cost": "92.00",
              "eval_cost": "0.51",
              "prefix_cost": "138.42",
              "data_read_per_join": "41"
            },
            "used_columns": [
              "product_id",
              "category_id",
              "link_type"
            ]
          }
        }
      ]
    }
  }
}

Result

product_id category_ids
326 352,379,363,370,358,361,373,356,376,386,354,394,383,360,391,380,369,372,350,375,388,353,395,378,384,362,392,357,381,349M,355,368,359,371,374,389,396,377,385,393,351,382,390
327 377,385,351,382,352,379,363,370,358,361,373,356,376,386,354,383,360,380,369,372,350,375,353,378,384,362,357,381,349M,355,359,371,374
367 397M,400
421 355,396,341,359,393,343,390,342,351,352,338,363,394,345,358,361,391,356,337M,354,344,360,388,395,339,392,350,353,368,340,362,357,349
886 447M
891 447M
894 447M
895 447M
918 400,397M
1144 397M
1182 397M
1189 397M