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 (
    47488, 47234, 47232, 51280, 47452, 47248, 
    47058, 51278, 47051, 47046, 47045, 
    47044, 47043, 47042, 47041, 47040, 
    47039, 47038, 47037, 47036, 47035, 
    47034, 47235, 47115, 47113, 47112, 
    47111, 47110, 47109, 47108, 47107, 
    47106, 47105, 47104, 47103, 47102, 
    47101, 46931, 46946, 46945, 46944, 
    47214, 47213, 47212, 47211, 47210, 
    47209, 47208, 47207, 47206, 47205, 
    47204, 47203, 47202, 47201, 47200, 
    47199, 47196, 46936, 46876, 46875, 
    46918, 46785, 46746, 46943, 46942, 
    46941, 46940, 46910, 46703, 47010, 
    47009, 47008, 46935, 46929, 46928, 
    46927, 46926, 46688, 46925
  ) 
GROUP BY 
  cscart_products_categories.product_id

Query time 0.00115

Explain
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE cscart_products_categories range PRIMARY,pt pt 3 86 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
46688 22M 0
46703 22M 0
46746 22M 0
46785 22M 0
46875 22M 0
46876 22M 0
46910 22M 0
46918 22M 0
46925 22M 0
46926 22M 0
46927 22M 0
46928 22M 0
46929 22M 0
46931 22M 0
46935 22M 0
46936 22M 0
46940 22M 0
46941 22M 0
46942 22M 0
46943 22M 0
46944 22M 0
46945 22M 0
46946 22M 0
47008 22M 0
47009 22M 0
47010 22M 0
47034 22M 0
47035 22M 0
47036 22M 0
47037 22M 0
47038 32,22M 0
47039 22M 0
47040 32,22M 0
47041 32,22M 0
47042 22M 0
47043 32,22M 0
47044 32,22M 0
47045 32,22M 0
47046 22M 0
47051 22M 0
47058 22M 0
47101 22M 0
47102 22M 0
47103 22M 0
47104 22M 0
47105 22M 0
47106 22M 0
47107 22M 0
47108 22M 0
47109 22M 0
47110 22M 0
47111 22M 0
47112 22M 0
47113 22M 0
47115 22M 0
47196 22M 0
47199 22M 0
47200 22M 0
47201 22M 0
47202 22M 0
47203 22M 0
47204 22M 0
47205 22M 0
47206 22M 0
47207 22M 0
47208 22M 0
47209 22M 0
47210 22M 0
47211 22M 0
47212 22M 0
47213 22M 0
47214 22M 0
47232 22M 0
47234 22M 0
47235 22M 0
47248 22M 0
47452 22M 0
47488 22M 0
51278 22M 0
51280 22M 0