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, 
  product_position_source.position AS position 
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') 
  LEFT JOIN cscart_products_categories AS product_position_source ON cscart_products_categories.product_id = product_position_source.product_id 
  AND product_position_source.category_id = 7149 
WHERE 
  cscart_products_categories.product_id IN (
    92557, 91945, 91946, 91947, 91948, 91949, 
    91950, 91951, 82371, 82450, 82451, 
    82449, 84909, 91944, 82353, 91938, 
    82352, 91937, 91939, 91940, 91941, 
    91942, 91943, 86856, 82386, 82403, 
    82410, 82424, 82385, 82362, 82448, 
    82360, 82404, 82342, 82367, 82338, 
    82337, 91978, 91981, 82361, 82563, 
    82567, 82571, 91977, 91979, 91980, 
    91982, 91983, 82556, 85583, 89595, 
    89596, 89597, 82336, 91936, 91970, 
    91973, 91985, 91986, 91987, 91988, 
    91989, 91990, 91991, 91969, 91971, 
    91972, 91974, 91975, 86810, 82557, 
    84045, 82369, 82375, 82357, 89590, 
    89589, 86806, 82560, 82565, 82569, 
    82573, 82562, 82566, 82570, 91968, 
    84289, 82555, 82553, 82391, 82554, 
    82559, 82552, 82564, 82568, 82572
  ) 
GROUP BY 
  cscart_products_categories.product_id

Query time 0.01860

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "132.19"
    },
    "grouping_operation": {
      "using_temporary_table": true,
      "using_filesort": true,
      "cost_info": {
        "sort_cost": "7.74"
      },
      "nested_loop": [
        {
          "table": {
            "table_name": "cscart_categories",
            "access_type": "ALL",
            "possible_keys": [
              "PRIMARY",
              "c_status",
              "p_category_id"
            ],
            "rows_examined_per_scan": 208,
            "rows_produced_per_join": 8,
            "filtered": "4.00",
            "cost_info": {
              "read_cost": "20.72",
              "eval_cost": "0.83",
              "prefix_cost": "21.55",
              "data_read_per_join": "21K"
            },
            "used_columns": [
              "category_id",
              "usergroup_ids",
              "status",
              "storefront_id"
            ],
            "attached_condition": "((`nuie_scalesta_net`.`cscart_categories`.`storefront_id` in (0,1)) and ((`nuie_scalesta_net`.`cscart_categories`.`usergroup_ids` = '') or (0 <> find_in_set(0,`nuie_scalesta_net`.`cscart_categories`.`usergroup_ids`)) or (0 <> find_in_set(1,`nuie_scalesta_net`.`cscart_categories`.`usergroup_ids`))) and (`nuie_scalesta_net`.`cscart_categories`.`status` in ('A','H')))"
          }
        },
        {
          "table": {
            "table_name": "cscart_products_categories",
            "access_type": "ref",
            "possible_keys": [
              "PRIMARY",
              "link_type",
              "pt"
            ],
            "key": "PRIMARY",
            "used_key_parts": [
              "category_id"
            ],
            "key_length": "3",
            "ref": [
              "nuie_scalesta_net.cscart_categories.category_id"
            ],
            "rows_examined_per_scan": 117,
            "rows_produced_per_join": 7,
            "filtered": "0.79",
            "cost_info": {
              "read_cost": "2.33",
              "eval_cost": "0.77",
              "prefix_cost": "121.75",
              "data_read_per_join": "123"
            },
            "used_columns": [
              "product_id",
              "category_id",
              "link_type"
            ],
            "attached_condition": "(`nuie_scalesta_net`.`cscart_products_categories`.`product_id` in (92557,91945,91946,91947,91948,91949,91950,91951,82371,82450,82451,82449,84909,91944,82353,91938,82352,91937,91939,91940,91941,91942,91943,86856,82386,82403,82410,82424,82385,82362,82448,82360,82404,82342,82367,82338,82337,91978,91981,82361,82563,82567,82571,91977,91979,91980,91982,91983,82556,85583,89595,89596,89597,82336,91936,91970,91973,91985,91986,91987,91988,91989,91990,91991,91969,91971,91972,91974,91975,86810,82557,84045,82369,82375,82357,89590,89589,86806,82560,82565,82569,82573,82562,82566,82570,91968,84289,82555,82553,82391,82554,82559,82552,82564,82568,82572))"
          }
        },
        {
          "table": {
            "table_name": "product_position_source",
            "access_type": "eq_ref",
            "possible_keys": [
              "PRIMARY",
              "pt"
            ],
            "key": "PRIMARY",
            "used_key_parts": [
              "category_id",
              "product_id"
            ],
            "key_length": "6",
            "ref": [
              "const",
              "nuie_scalesta_net.cscart_products_categories.product_id"
            ],
            "rows_examined_per_scan": 1,
            "rows_produced_per_join": 7,
            "filtered": "100.00",
            "cost_info": {
              "read_cost": "1.93",
              "eval_cost": "0.77",
              "prefix_cost": "124.46",
              "data_read_per_join": "123"
            },
            "used_columns": [
              "product_id",
              "category_id",
              "position"
            ]
          }
        }
      ]
    }
  }
}

Result

product_id category_ids position
82336 7151M,7301
82337 7151M,7301
82338 7151M,7301
82342 7151M,7301
82352 7160M,7305
82353 7160M,7305
82357 7148,7149,7152M 0
82360 7151M,7301
82361 7148,7149,7160M 0
82362 7151M,7301
82367 7151M,7301
82369 7161M,7303
82371 7160M,7305
82375 7151M,7301
82385 7160M,7305
82386 7160M,7305
82391 7148,7149,7152M 0
82403 7151M,7301
82404 7151M,7301
82410 7151M,7301
82424 7151M,7301
82448 7148,7149,7160M 0
82449 7160M,7305
82450 7160M,7305
82451 7160M,7305
82552 7161M,7303
82553 7161M,7303
82554 7161M,7303
82555 7161M,7303
82556 7161M,7303
82557 7161M,7303
82559 7161M,7303
82560 7161M,7303
82562 7161M,7303
82563 7161M,7303
82564 7161M,7303
82565 7161M,7303
82566 7161M,7303
82567 7161M,7303
82568 7161M,7303
82569 7161M,7303
82570 7161M,7303
82571 7161M,7303
82572 7161M,7303
82573 7161M,7303
84045 7162M
84289 7148,7149,7152M 0
84909 7148,7149,7160M 0
85583 7149M,7182,7300 0
86806 7151M,7301
86810 7151M,7301
86856 7149M,7182,7300 0
89589 7151M,7301
89590 7151M,7301
89595 7151M,7301
89596 7151M,7301
89597 7151M,7301
91936 7151M,7301
91937 7151M,7301
91938 7151M,7301
91939 7151M,7301
91940 7151M,7301
91941 7151M,7301
91942 7151M,7301
91943 7151M,7301
91944 7160M,7305
91945 7160M,7305
91946 7160M,7305
91947 7160M,7305
91948 7160M,7305
91949 7160M,7305
91950 7160M,7305
91951 7160M,7305
91968 7161M,7303
91969 7161M,7303
91970 7161M,7303
91971 7161M,7303
91972 7161M,7303
91973 7161M,7303
91974 7161M,7303
91975 7161M,7303
91977 7161M,7303
91978 7161M,7303
91979 7161M,7303
91980 7161M,7303
91981 7161M,7303
91982 7161M,7303
91983 7161M,7303
91985 7161M,7303
91986 7161M,7303
91987 7161M,7303
91988 7161M,7303
91989 7161M,7303
91990 7161M,7303
91991 7161M,7303
92557 7151M,7301