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 (
    50522, 50521, 50520, 50519, 50518, 50517, 
    50516, 50515, 51281, 50485, 50484, 
    50462, 50461, 50103, 50447, 50408, 
    50465, 50464, 50463, 50393, 50389, 
    50388, 50387, 50072, 50267, 50234, 
    50233, 50232, 50231, 50230, 50229, 
    50228, 50227, 50226, 50225, 50224, 
    50223, 50067, 50066, 50065, 50064, 
    50275, 50274, 50269, 50265, 50039, 
    50001, 88490, 88489, 50040, 50034, 
    50033, 50025, 50152, 50151, 50124, 
    50123, 50122, 49944, 50110, 50107, 
    49954, 49953, 49952, 49951, 49950, 
    50219, 50218, 50217, 50216, 50215, 
    50214, 50213, 50212, 50211, 50210, 
    50209, 50208, 50207, 50206
  ) 
GROUP BY 
  cscart_products_categories.product_id

Query time 0.00112

Explain
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE cscart_products_categories range PRIMARY,pt pt 3 87 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
49944 22M 0
49950 22M 0
49951 22M 0
49952 22M 0
49953 22M 0
49954 22M 0
50001 22M 0
50025 22M 0
50033 22M 0
50034 22M 0
50039 22M 0
50040 22M 0
50064 22M 0
50065 22M 0
50066 22M 0
50067 22M 0
50072 22M 0
50103 22M 0
50107 22M 0
50110 22M 0
50122 22M 0
50123 22M 0
50124 22M 0
50151 22M 0
50152 22M 0
50206 22M 0
50207 22M 0
50208 22M 0
50209 22M 0
50210 22M 0
50211 22M 0
50212 22M 0
50213 22M 0
50214 22M 0
50215 22M 0
50216 22M 0
50217 22M 0
50218 22M 0
50219 22M 0
50223 22M 0
50224 22M 0
50225 22M 0
50226 22M 0
50227 22M 0
50228 22M 0
50229 22M 0
50230 22M 0
50231 22M 0
50232 22M 0
50233 22M 0
50234 33,22M 0
50265 22M 0
50267 22M 0
50269 22M 0
50274 22M 0
50275 22M 0
50387 33,22M 0
50388 33,22M 0
50389 33,22M 0
50393 22M 0
50408 22M 0
50447 22M 0
50461 22M 0
50462 22M 0
50463 34,22M 0
50464 34,22M 0
50465 34,22M 0
50484 22M 0
50485 22M 0
50515 22M 0
50516 22M 0
50517 22M 0
50518 22M 0
50519 22M 0
50520 22M 0
50521 22M 0
50522 22M 0
51281 22M 0
88489 22M 0
88490 22M 0