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 = 7173 
WHERE 
  cscart_products_categories.product_id IN (
    87359, 82436, 87381, 82435, 87375, 87372, 
    82487, 87371, 91481, 91480, 82491, 
    89563, 82490, 82489, 91478, 82488, 
    91479, 85638, 85637, 85636, 85635, 
    92560, 92561, 92562, 92563, 92564, 
    92565, 92566, 92567, 92568, 94012, 
    95074, 95075, 95076, 95077, 95078, 
    95079, 95080, 95081, 95082, 95083, 
    95341, 95342, 95356, 95357, 95473, 
    95474, 95476, 95477, 95479, 95480, 
    95482, 95483, 96186, 96187, 96188, 
    96781, 96782, 96793, 96794, 96795, 
    96796, 96797, 96798, 96799, 96800, 
    96801, 96802, 96803, 96804, 96805, 
    96806, 96959, 96960, 96961, 96962, 
    96963, 96964, 96965, 96966, 96967, 
    96968, 98517, 98518, 98519, 98520, 
    98893, 98898, 98899, 98901, 98905, 
    100338, 100339, 100340, 100343, 100345
  ) 
GROUP BY 
  cscart_products_categories.product_id

Query time 0.01666

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "86.69"
    },
    "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": 96,
            "rows_produced_per_join": 96,
            "filtered": "100.00",
            "using_index": true,
            "cost_info": {
              "read_cost": "9.89",
              "eval_cost": "9.60",
              "prefix_cost": "19.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 (87359,82436,87381,82435,87375,87372,82487,87371,91481,91480,82491,89563,82490,82489,91478,82488,91479,85638,85637,85636,85635,92560,92561,92562,92563,92564,92565,92566,92567,92568,94012,95074,95075,95076,95077,95078,95079,95080,95081,95082,95083,95341,95342,95356,95357,95473,95474,95476,95477,95479,95480,95482,95483,96186,96187,96188,96781,96782,96793,96794,96795,96796,96797,96798,96799,96800,96801,96802,96803,96804,96805,96806,96959,96960,96961,96962,96963,96964,96965,96966,96967,96968,98517,98518,98519,98520,98893,98898,98899,98901,98905,100338,100339,100340,100343,100345))"
          }
        },
        {
          "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": 96,
            "filtered": "100.00",
            "cost_info": {
              "read_cost": "24.00",
              "eval_cost": "9.60",
              "prefix_cost": "53.09",
              "data_read_per_join": "1K"
            },
            "used_columns": [
              "product_id",
              "category_id",
              "position"
            ]
          }
        },
        {
          "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": "24.00",
              "eval_cost": "0.48",
              "prefix_cost": "86.69",
              "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')))"
          }
        }
      ]
    }
  }
}

Result

product_id category_ids position
82435 7173M 0
82436 7173M 0
82487 7173M 0
82488 7173M 0
82489 7173M 0
82490 7173M 0
82491 7173M 0
85635 7173M 0
85636 7173M 0
85637 7173M 0
85638 7173M 0
87359 7173M 0
87371 7173M 0
87372 7173M 0
87375 7173M 0
87381 7173M 0
89563 7173M 0
91478 7173M 0
91479 7173M 0
91480 7173M 0
91481 7173M 0
92560 7173M 0
92561 7173M 0
92562 7173M 0
92563 7173M 0
92564 7173M 0
92565 7173M 0
92566 7173M 0
92567 7173M 0
92568 7173M 0
94012 7173M 0
95074 7173M 0
95075 7173M 0
95076 7173M 0
95077 7173M 0
95078 7173M 0
95079 7173M 0
95080 7173M 0
95081 7173M 0
95082 7173M 0
95083 7173M 0
95341 7173M 0
95342 7173M 0
95356 7173M 0
95357 7173M 0
95473 7173M 0
95474 7173M 0
95476 7173M 0
95477 7173M 0
95479 7173M 0
95480 7173M 0
95482 7173M 0
95483 7173M 0
96186 7173M 0
96187 7173M 0
96188 7173M 0
96781 7173M 0
96782 7173M 0
96793 7173M 0
96794 7173M 0
96795 7173M 0
96796 7173M 0
96797 7173M 0
96798 7173M 0
96799 7173M 0
96800 7173M 0
96801 7173M 0
96802 7173M 0
96803 7173M 0
96804 7173M 0
96805 7173M 0
96806 7173M 0
96959 7173M 0
96960 7173M 0
96961 7173M 0
96962 7173M 0
96963 7173M 0
96964 7173M 0
96965 7173M 0
96966 7173M 0
96967 7173M 0
96968 7173M 0
98517 7173M 0
98518 7173M 0
98519 7173M 0
98520 7173M 0
98893 7173M 0
98898 7173M 0
98899 7173M 0
98901 7173M 0
98905 7173M 0
100338 7173M 0
100339 7173M 0
100340 7173M 0
100343 7173M 0
100345 7173M 0