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 = 7170 
WHERE 
  cscart_products_categories.product_id IN (
    83604, 84525, 84526, 84591, 84592, 90889, 
    90891, 90968, 90970, 82631, 82855, 
    82856, 82928, 82929, 83001, 83002, 
    83517, 83518, 83525, 83526, 83528, 
    83022, 83023, 90858, 90859, 90937, 
    90938, 83050, 83595, 84675, 84676, 
    90886, 90965, 84629, 84630, 85366, 
    85367, 89765, 84820, 84821, 91168, 
    86146, 86169, 86662, 86731, 86607, 
    86676, 84348, 89071, 89072, 89768, 
    83051, 83600, 90887, 90966, 89429, 
    89821, 89873, 89945, 91511, 82863, 
    82936, 83009, 83445, 83450, 83020, 
    90856, 90935, 87306, 87307, 87318, 
    87319, 87330, 87331, 87342, 87343, 
    82600, 83076, 83629, 90912, 90991, 
    86638, 86707, 82717, 83455, 85086, 
    85172, 85218, 85264, 83079, 83080, 
    83577, 83579, 90916, 90918, 90995
  ) 
GROUP BY 
  cscart_products_categories.product_id

Query time 0.00131

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "88.85"
    },
    "grouping_operation": {
      "using_filesort": false,
      "nested_loop": [
        {
          "table": {
            "table_name": "cscart_products_categories",
            "access_type": "range",
            "possible_keys": [
              "PRIMARY",
              "link_type",
              "pt"
            ],
            "key": "pt",
            "used_key_parts": [
              "product_id"
            ],
            "key_length": "3",
            "rows_examined_per_scan": 156,
            "rows_produced_per_join": 156,
            "filtered": "100.00",
            "using_index": true,
            "cost_info": {
              "read_cost": "15.92",
              "eval_cost": "15.60",
              "prefix_cost": "31.52",
              "data_read_per_join": "2K"
            },
            "used_columns": [
              "product_id",
              "category_id",
              "link_type"
            ],
            "attached_condition": "(`nuie_scalesta_net`.`cscart_products_categories`.`product_id` in (83604,84525,84526,84591,84592,90889,90891,90968,90970,82631,82855,82856,82928,82929,83001,83002,83517,83518,83525,83526,83528,83022,83023,90858,90859,90937,90938,83050,83595,84675,84676,90886,90965,84629,84630,85366,85367,89765,84820,84821,91168,86146,86169,86662,86731,86607,86676,84348,89071,89072,89768,83051,83600,90887,90966,89429,89821,89873,89945,91511,82863,82936,83009,83445,83450,83020,90856,90935,87306,87307,87318,87319,87330,87331,87342,87343,82600,83076,83629,90912,90991,86638,86707,82717,83455,85086,85172,85218,85264,83079,83080,83577,83579,90916,90918,90995))"
          }
        },
        {
          "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": [
              "nuie_scalesta_net.cscart_products_categories.category_id"
            ],
            "rows_examined_per_scan": 1,
            "rows_produced_per_join": 7,
            "filtered": "5.00",
            "cost_info": {
              "read_cost": "39.00",
              "eval_cost": "0.78",
              "prefix_cost": "86.12",
              "data_read_per_join": "20K"
            },
            "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": "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.95",
              "eval_cost": "0.78",
              "prefix_cost": "88.85",
              "data_read_per_join": "124"
            },
            "used_columns": [
              "product_id",
              "category_id",
              "position"
            ]
          }
        }
      ]
    }
  }
}

Result

product_id category_ids position
82600 7192M
82631 7170,7171M 0
82717 7170,7191M 0
82855 7192M
82856 7192M
82863 7170,7191M 0
82928 7192M
82929 7192M
82936 7170,7191M 0
83001 7192M
83002 7192M
83009 7170,7191M 0
83020 7170,7191M 0
83022 7170,7191M 0
83023 7170,7191M 0
83050 7170,7171M 0
83051 7170,7171M 0
83076 7192M
83079 7170,7191M 0
83080 7170,7191M 0
83445 7170,7191M 0
83450 7170,7191M 0
83455 7170,7191M 0
83517 7192M
83518 7192M
83525 7192M
83526 7192M
83528 7170,7171M 0
83577 7170,7191M 0
83579 7170,7191M 0
83595 7170,7171M 0
83600 7170,7171M 0
83604 7170,7171M 0
83629 7192M
84348 7170,7200M 0
84525 7223M
84526 7223M
84591 7223M
84592 7223M
84629 7223M
84630 7223M
84675 7223M
84676 7223M
84820 7170,7171M 0
84821 7170,7171M 0
85086 7192M
85172 7192M
85218 7192M
85264 7192M
85366 7192M
85367 7192M
86146 7192M
86169 7192M
86607 7170,7191,7310M 0
86638 7192M
86662 7192M
86676 7170,7191,7310M 0
86707 7192M
86731 7192M
87306 7170,7171M 0
87307 7170,7171M 0
87318 7170,7171M 0
87319 7170,7171M 0
87330 7170,7171M 0
87331 7170,7171M 0
87342 7170,7171M 0
87343 7170,7171M 0
89071 7192M
89072 7192M
89429 7223M
89765 7170,7191M 0
89768 7170,7171M 0
89821 7170,7171M 0
89873 7170,7171M 0
89945 7170,7171M 0
90856 7191,7170M 0
90858 7191,7170M 0
90859 7191,7170M 0
90886 7171,7170M 0
90887 7171,7170M 0
90889 7171,7170M 0
90891 7171,7170M 0
90912 7192M
90916 7191,7170M 0
90918 7191,7170M 0
90935 7191,7170M 0
90937 7191,7170M 0
90938 7191,7170M 0
90965 7171,7170M 0
90966 7171,7170M 0
90968 7171,7170M 0
90970 7171,7170M 0
90991 7192M
90995 7191,7170M 0
91168 7171,7170M 0
91511 7171,7170M 0