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 = 7172 
WHERE 
  cscart_products_categories.product_id IN (
    82485, 89533, 85606, 85605, 89532, 93902, 
    93903, 93904, 93905, 93906, 93910, 
    93911, 93912, 94965, 94966, 94967, 
    94968, 94969, 94970, 94971, 94972, 
    94973, 94974, 94975, 94976, 94977, 
    94978, 94979, 94980, 94981, 94982, 
    95450, 95459, 95463, 95511, 95512, 
    95513, 95517, 95518, 95519, 95527, 
    95528, 95542, 95543, 95544, 96792, 
    96848, 96849, 96850, 96851, 96852, 
    96853, 96854, 96855, 96856, 96857, 
    96858, 96859, 96860, 96861, 96862, 
    96863, 96864, 96865, 98509, 98510, 
    100187, 100188, 100189, 100190, 100191, 
    100195, 100196, 100197, 100298, 100300
  ) 
GROUP BY 
  cscart_products_categories.product_id

Query time 0.01578

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "68.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": 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 (82485,89533,85606,85605,89532,93902,93903,93904,93905,93906,93910,93911,93912,94965,94966,94967,94968,94969,94970,94971,94972,94973,94974,94975,94976,94977,94978,94979,94980,94981,94982,95450,95459,95463,95511,95512,95513,95517,95518,95519,95527,95528,95542,95543,95544,96792,96848,96849,96850,96851,96852,96853,96854,96855,96856,96857,96858,96859,96860,96861,96862,96863,96864,96865,98509,98510,100187,100188,100189,100190,100191,100195,100196,100197,100298,100300))"
          }
        },
        {
          "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": 76,
            "filtered": "100.00",
            "cost_info": {
              "read_cost": "19.00",
              "eval_cost": "7.60",
              "prefix_cost": "42.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": 3,
            "filtered": "5.00",
            "cost_info": {
              "read_cost": "19.00",
              "eval_cost": "0.38",
              "prefix_cost": "68.69",
              "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')))"
          }
        }
      ]
    }
  }
}

Result

product_id category_ids position
82485 7172M 0
85605 7172M 0
85606 7172M 0
89532 7172M 0
89533 7172M 0
93902 7172M 0
93903 7172M 0
93904 7172M 0
93905 7172M 0
93906 7172M 0
93910 7172M 0
93911 7172M 0
93912 7172M 0
94965 7172M 0
94966 7172M 0
94967 7172M 0
94968 7172M 0
94969 7172M 0
94970 7172M 0
94971 7172M 0
94972 7172M 0
94973 7172M 0
94974 7172M 0
94975 7172M 0
94976 7172M 0
94977 7172M 0
94978 7172M 0
94979 7172M 0
94980 7172M 0
94981 7172M 0
94982 7172M 0
95450 7172M 0
95459 7172M 0
95463 7172M 0
95511 7172M 0
95512 7172M 0
95513 7172M 0
95517 7172M 0
95518 7172M 0
95519 7172M 0
95527 7172M 0
95528 7172M 0
95542 7172M 0
95543 7172M 0
95544 7172M 0
96792 7172M 0
96848 7172M 0
96849 7172M 0
96850 7172M 0
96851 7172M 0
96852 7172M 0
96853 7172M 0
96854 7172M 0
96855 7172M 0
96856 7172M 0
96857 7172M 0
96858 7172M 0
96859 7172M 0
96860 7172M 0
96861 7172M 0
96862 7172M 0
96863 7172M 0
96864 7172M 0
96865 7172M 0
98509 7172M 0
98510 7172M 0
100187 7172M 0
100188 7172M 0
100189 7172M 0
100190 7172M 0
100191 7172M 0
100195 7172M 0
100196 7172M 0
100197 7172M 0
100298 7172M 0
100300 7172M 0