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 (
    85486, 85487, 89782, 89783, 91065, 91066, 
    84536, 84537, 84602, 84603, 82590, 
    83349, 89035, 85330, 85427, 85478, 
    85529, 86497, 86498, 86773, 86774, 
    89780, 89830, 89831, 89882, 89883, 
    89954, 89955, 91520, 91521, 85311, 
    85312, 85408, 85409, 85459, 85460, 
    85510, 85511, 88871, 88872, 89998, 
    89999, 82576, 82577, 83163, 83164, 
    85075, 85161
  ) 
GROUP BY 
  cscart_products_categories.product_id

Query time 0.00187

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "43.42"
    },
    "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": 76,
            "rows_produced_per_join": 76,
            "filtered": "100.00",
            "using_index": true,
            "cost_info": {
              "read_cost": "7.89",
              "eval_cost": "7.60",
              "prefix_cost": "15.49",
              "data_read_per_join": "1K"
            },
            "used_columns": [
              "product_id",
              "category_id",
              "link_type"
            ],
            "attached_condition": "(`nuie_scalesta_net`.`cscart_products_categories`.`product_id` in (85486,85487,89782,89783,91065,91066,84536,84537,84602,84603,82590,83349,89035,85330,85427,85478,85529,86497,86498,86773,86774,89780,89830,89831,89882,89883,89954,89955,91520,91521,85311,85312,85408,85409,85459,85460,85510,85511,88871,88872,89998,89999,82576,82577,83163,83164,85075,85161))"
          }
        },
        {
          "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": 3,
            "filtered": "5.00",
            "cost_info": {
              "read_cost": "19.00",
              "eval_cost": "0.38",
              "prefix_cost": "42.09",
              "data_read_per_join": "9K"
            },
            "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": 3,
            "filtered": "100.00",
            "cost_info": {
              "read_cost": "0.95",
              "eval_cost": "0.38",
              "prefix_cost": "43.42",
              "data_read_per_join": "60"
            },
            "used_columns": [
              "product_id",
              "category_id",
              "position"
            ]
          }
        }
      ]
    }
  }
}

Result

product_id category_ids position
82576 7170,7191M 0
82577 7170,7191M 0
82590 7170,7171M 0
83163 7170,7191M 0
83164 7170,7191M 0
83349 7170,7171M 0
84536 7223M
84537 7223M
84602 7223M
84603 7223M
85075 7192M
85161 7192M
85311 7192M
85312 7192M
85330 7192M
85408 7192M
85409 7192M
85427 7192M
85459 7192M
85460 7192M
85478 7192M
85486 7170,7171M 0
85487 7170,7171M 0
85510 7192M
85511 7192M
85529 7192M
86497 7192M
86498 7192M
86773 7192M
86774 7192M
88871 7170,7191M 0
88872 7170,7191M 0
89035 7170,7223M 0
89780 7170,7191M 0
89782 7170,7191M 0
89783 7170,7191M 0
89830 7170,7191M 0
89831 7170,7191M 0
89882 7170,7191M 0
89883 7170,7191M 0
89954 7170,7191,7310M 0
89955 7170,7191,7310M 0
89998 7170,7191M 0
89999 7170,7191M 0
91065 7191,7170M 0
91066 7191,7170M 0
91520 7191,7170M 0
91521 7191,7170M 0