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 = 22 
WHERE 
  cscart_products_categories.product_id IN (
    52499, 52498, 52497, 52496, 52495, 52494, 
    52493, 52492, 52491, 52490, 52489, 
    52488, 52487, 52486, 52485, 52484, 
    52483, 52482, 52481, 52480, 52479, 
    52478, 52477, 111379, 111375, 52473, 
    52472, 52471, 52470, 52469, 52468, 
    52467, 52466, 52626, 52458, 52457, 
    52456, 52455, 52454, 52453, 52451, 
    52450, 52449, 52448, 59351, 52580, 
    52579, 52447, 52446, 52431, 52426, 
    52423, 52416, 52411, 52683, 52399, 
    52398, 52394, 52393, 52392, 52391, 
    52390, 52389, 52388, 52387, 52386, 
    52385, 52384, 52383, 52382, 52381, 
    52380, 52379, 52378, 52377, 52376, 
    52375, 52374, 52373, 52372
  ) 
GROUP BY 
  cscart_products_categories.product_id

Query time 0.00105

Explain
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE cscart_products_categories range PRIMARY,pt pt 3 82 Using where; Using index
1 SIMPLE cscart_categories eq_ref PRIMARY,c_status,p_category_id PRIMARY 3 toolboxdigitalshop_dev.cscart_products_categories.category_id 1 Using where
1 SIMPLE product_position_source eq_ref PRIMARY,pt PRIMARY 6 const,toolboxdigitalshop_dev.cscart_products_categories.product_id 1

Result

product_id category_ids position
52372 22M 0
52373 22M 0
52374 22M 0
52375 22M 0
52376 22M 0
52377 22M 0
52378 22M 0
52379 22M 0
52380 22M 0
52381 22M 0
52382 22M 0
52383 22M 0
52384 22M 0
52385 22M 0
52386 22M 0
52387 22M 0
52388 22M 0
52389 22M 0
52390 22M 0
52391 22M 0
52392 22M 0
52393 22M 0
52394 22M 0
52398 22M 0
52399 22M 0
52411 22M 0
52416 22M 0
52423 22M 0
52426 22M 0
52431 22M 0
52446 22M 0
52447 22M 0
52448 22M 0
52449 22M 0
52450 22M 0
52451 22M 0
52453 22M 0
52454 22M 0
52455 22M 0
52456 22M 0
52457 22M 0
52458 22M 0
52466 22M 0
52467 22M 0
52468 22M 0
52469 22M 0
52470 22M 0
52471 22M 0
52472 22M 0
52473 22M 0
52477 22M 0
52478 22M 0
52479 22M 0
52480 22M 0
52481 22M 0
52482 22M 0
52483 33,22M 0
52484 22M 0
52485 22M 0
52486 33,22M 0
52487 22M 0
52488 22M 0
52489 22M 0
52490 22M 0
52491 22M 0
52492 22M 0
52493 22M 0
52494 22M 0
52495 22M 0
52496 22M 0
52497 22M 0
52498 22M 0
52499 22M 0
52579 22M 0
52580 22M 0
52626 22M 0
52683 22M 0
59351 22M 0
111375 22M 0
111379 22M 0