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 (
    41546, 41545, 41544, 41543, 41429, 41268, 
    41267, 41361, 41572, 41571, 41246, 
    41245, 41244, 41243, 41242, 41220, 
    41218, 41173, 41167, 41644, 41643, 
    41642, 41641, 41640, 41639, 41159, 
    41154, 41128, 41117, 41116, 41113, 
    41146, 41145, 41211, 41213, 41192, 
    41058, 41054, 41053, 41103, 41017, 
    40942, 40941, 40940, 40934, 40933, 
    40932, 40931, 40930, 40929, 40928, 
    40927, 40926, 40925, 40923, 40922, 
    40921, 40920, 40919, 40918, 40917, 
    40916, 40915, 40914, 40913, 40912, 
    40911, 40910, 40909, 40908, 40907, 
    40906, 40905, 40904, 40903, 40902, 
    40901, 40900, 40899, 41623
  ) 
GROUP BY 
  cscart_products_categories.product_id

Query time 0.00092

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
40899 22M 0
40900 22M 0
40901 22M 0
40902 22M 0
40903 22M 0
40904 22M 0
40905 22M 0
40906 22M 0
40907 22M 0
40908 22M 0
40909 22M 0
40910 22M 0
40911 22M 0
40912 22M 0
40913 22M 0
40914 22M 0
40915 22M 0
40916 22M 0
40917 22M 0
40918 22M 0
40919 22M 0
40920 22M 0
40921 22M 0
40922 22M 0
40923 22M 0
40925 22M 0
40926 22M 0
40927 22M 0
40928 22M 0
40929 22M 0
40930 22M 0
40931 22M 0
40932 22M 0
40933 22M 0
40934 22M 0
40940 22M 0
40941 22M 0
40942 22M 0
41017 33,22M 0
41053 22M 0
41054 32,22M 0
41058 22M 0
41103 22M 0
41113 22M 0
41116 22M 0
41117 22M 0
41128 22M 0
41145 22M 0
41146 22M 0
41154 22M 0
41159 22M 0
41167 22M 0
41173 22M 0
41192 22M 0
41211 22M 0
41213 22M 0
41218 22M 0
41220 22M 0
41242 22M 0
41243 22M 0
41244 22M 0
41245 22M 0
41246 22M 0
41267 22M 0
41268 22M 0
41361 22M 0
41429 22M 0
41543 22M 0
41544 22M 0
41545 22M 0
41546 22M 0
41571 22M 0
41572 22M 0
41623 22M 0
41639 22M 0
41640 22M 0
41641 22M 0
41642 22M 0
41643 22M 0
41644 22M 0