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 (
    85506, 85508, 90871, 90872, 90950, 90951, 
    82624, 83489, 85096, 82579, 82795, 
    82796, 82868, 82869, 82941, 82942, 
    83153, 83154, 83158, 83159, 83267, 
    91088, 91174, 91229, 83555, 83556, 
    85116, 85117, 88893, 88894, 89834, 
    89835, 89886, 89887, 89958, 89959, 
    91462, 91463, 91466, 91467, 91524, 
    91525, 83573, 86490, 86766, 85304, 
    85401, 85452
  ) 
GROUP BY 
  cscart_products_categories.product_id

Query time 0.00178

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "52.50"
    },
    "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": 92,
            "rows_produced_per_join": 92,
            "filtered": "100.00",
            "using_index": true,
            "cost_info": {
              "read_cost": "9.49",
              "eval_cost": "9.20",
              "prefix_cost": "18.69",
              "data_read_per_join": "1K"
            },
            "used_columns": [
              "product_id",
              "category_id",
              "link_type"
            ],
            "attached_condition": "(`nuie_scalesta_net`.`cscart_products_categories`.`product_id` in (85506,85508,90871,90872,90950,90951,82624,83489,85096,82579,82795,82796,82868,82869,82941,82942,83153,83154,83158,83159,83267,91088,91174,91229,83555,83556,85116,85117,88893,88894,89834,89835,89886,89887,89958,89959,91462,91463,91466,91467,91524,91525,83573,86490,86766,85304,85401,85452))"
          }
        },
        {
          "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": 4,
            "filtered": "5.00",
            "cost_info": {
              "read_cost": "23.00",
              "eval_cost": "0.46",
              "prefix_cost": "50.89",
              "data_read_per_join": "12K"
            },
            "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": 4,
            "filtered": "100.00",
            "cost_info": {
              "read_cost": "1.15",
              "eval_cost": "0.46",
              "prefix_cost": "52.50",
              "data_read_per_join": "73"
            },
            "used_columns": [
              "product_id",
              "category_id",
              "position"
            ]
          }
        }
      ]
    }
  }
}

Result

product_id category_ids position
82579 7170,7191M 0
82624 7170,7171M 0
82795 7170,7191M 0
82796 7170,7191M 0
82868 7170,7191M 0
82869 7170,7191M 0
82941 7170,7191M 0
82942 7170,7191M 0
83153 7170,7191M 0
83154 7170,7191M 0
83158 7170,7191M 0
83159 7170,7191M 0
83267 7170,7191M 0
83489 7170,7171M 0
83555 7170,7171M 0
83556 7170,7171M 0
83573 7170,7192M 0
85096 7170,7171M 0
85116 7192M
85117 7192M
85304 7170,7171M 0
85401 7170,7171M 0
85452 7170,7171M 0
85506 7170,7171M 0
85508 7170,7171M 0
86490 7170,7171M 0
86766 7170,7171M 0
88893 7170,7191M 0
88894 7170,7191M 0
89834 7170,7191M 0
89835 7170,7191M 0
89886 7170,7191M 0
89887 7170,7191M 0
89958 7170,7191,7310M 0
89959 7170,7191,7310M 0
90871 7192M
90872 7192M
90950 7192M
90951 7192M
91088 7191,7170M 0
91174 7191,7170M 0
91229 7191,7170M 0
91462 7191,7170M 0
91463 7191,7170M 0
91466 7191,7170M 0
91467 7191,7170M 0
91524 7191,7170M 0
91525 7191,7170M 0