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 = 7213 
WHERE 
  cscart_products_categories.product_id IN (
    88783, 88689, 88736, 88581, 85016, 85022, 
    85028, 85034, 89214, 89227, 89240, 
    88249, 89043, 89042, 88245, 89451, 
    89464, 89472, 89480, 88237, 88178, 
    90809, 85724, 85741, 85751, 85761, 
    89456, 87459, 88977, 88994, 87458, 
    87568, 88241, 91419, 91420, 85731, 
    88782, 88983, 89841, 89893, 91532, 
    85666, 85686, 85698, 85710, 88202, 
    88214, 85674, 87512, 87528, 88688, 
    88735, 87511, 87527, 88456, 88474, 
    88490, 89789, 89213, 89226, 89239, 
    87545, 87544, 89031, 89033, 89041, 
    89030, 89032, 89040, 89045, 89044, 
    88781, 88687, 88734, 88580, 88579
  ) 
GROUP BY 
  cscart_products_categories.product_id

Query time 0.01677

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "129.73"
    },
    "grouping_operation": {
      "using_temporary_table": true,
      "using_filesort": true,
      "cost_info": {
        "sort_cost": "5.91"
      },
      "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": 5,
            "filtered": "0.60",
            "cost_info": {
              "read_cost": "2.33",
              "eval_cost": "0.59",
              "prefix_cost": "121.75",
              "data_read_per_join": "94"
            },
            "used_columns": [
              "product_id",
              "category_id",
              "link_type"
            ],
            "attached_condition": "(`nuie_scalesta_net`.`cscart_products_categories`.`product_id` in (88783,88689,88736,88581,85016,85022,85028,85034,89214,89227,89240,88249,89043,89042,88245,89451,89464,89472,89480,88237,88178,90809,85724,85741,85751,85761,89456,87459,88977,88994,87458,87568,88241,91419,91420,85731,88782,88983,89841,89893,91532,85666,85686,85698,85710,88202,88214,85674,87512,87528,88688,88735,87511,87527,88456,88474,88490,89789,89213,89226,89239,87545,87544,89031,89033,89041,89030,89032,89040,89045,89044,88781,88687,88734,88580,88579))"
          }
        },
        {
          "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": 5,
            "filtered": "100.00",
            "cost_info": {
              "read_cost": "1.48",
              "eval_cost": "0.59",
              "prefix_cost": "123.82",
              "data_read_per_join": "94"
            },
            "used_columns": [
              "product_id",
              "category_id",
              "position"
            ]
          }
        }
      ]
    }
  }
}

Result

product_id category_ids position
85016 7170,7213M 0
85022 7170,7213M 0
85028 7170,7213M 0
85034 7170,7213M 0
85666 7170,7213M 0
85674 7170,7213M 0
85686 7170,7213M 0
85698 7170,7213M 0
85710 7170,7213M 0
85724 7170,7213M 0
85731 7170,7213M 0
85741 7170,7213M 0
85751 7170,7213M 0
85761 7170,7213M 0
87458 7170,7213M 0
87459 7170,7213M 0
87511 7170,7213M 0
87512 7170,7213M 0
87527 7170,7213M 0
87528 7170,7213M 0
87544 7170,7213M 0
87545 7170,7213M 0
87568 7170,7213M 0
88178 7170,7213M 0
88202 7170,7213M 0
88214 7170,7213M 0
88237 7170,7213M 0
88241 7170,7213M 0
88245 7170,7213M 0
88249 7170,7213M 0
88456 7170,7213M 0
88474 7170,7213M 0
88490 7170,7213M 0
88579 7170,7213M 0
88580 7170,7213M 0
88581 7170,7213M 0
88687 7170,7213M 0
88688 7170,7213M 0
88689 7170,7213M 0
88734 7170,7213M 0
88735 7170,7213M 0
88736 7170,7213M 0
88781 7170,7213M 0
88782 7170,7213M 0
88783 7170,7213M 0
88977 7170,7213M 0
88983 7170,7213M 0
88994 7170,7213M 0
89030 7170,7213M 0
89031 7170,7213M 0
89032 7170,7213M 0
89033 7170,7213M 0
89040 7170,7213M 0
89041 7170,7213M 0
89042 7170,7213M 0
89043 7170,7213M 0
89044 7170,7213M 0
89045 7170,7213M 0
89213 7170,7213M 0
89214 7170,7213M 0
89226 7170,7213M 0
89227 7170,7213M 0
89239 7170,7213M 0
89240 7170,7213M 0
89451 7170,7213M 0
89456 7170,7213M 0
89464 7170,7213M 0
89472 7170,7213M 0
89480 7170,7213M 0
89789 7170,7213M 0
89841 7170,7213M 0
89893 7170,7213M 0
90809 7170,7213M 0
91419 7170M,7213 0
91420 7170M,7213 0
91532 7170M,7213 0