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 (
    47596, 47595, 47594, 47593, 47592, 47591, 
    47590, 47589, 47588, 47690, 47805, 
    47804, 47803, 47802, 47801, 47800, 
    47799, 47798, 47797, 47796, 47795, 
    47794, 47793, 47792, 47791, 47790, 
    47789, 47788, 47787, 47786, 47785, 
    47784, 47783, 47782, 47781, 47562, 
    47561, 47707, 47706, 47705, 47704, 
    47703, 47702, 47701, 47700, 51279, 
    47691, 47688, 47686, 47685, 47684, 
    47683, 47646, 47548, 47745, 47644, 
    47489, 47485, 47484, 47640, 47478, 
    47636, 47473, 47641, 47451, 47381, 
    47358, 47627, 47615, 47614, 47613, 
    47612, 47611, 47610, 47609, 47608, 
    47607, 47606, 47487, 47477
  ) 
GROUP BY 
  cscart_products_categories.product_id

Query time 0.00101

Explain
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE cscart_products_categories range PRIMARY,pt pt 3 81 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
47358 22M 0
47381 22M 0
47451 22M 0
47473 22M 0
47477 22M 0
47478 22M 0
47484 22M 0
47485 22M 0
47487 22M 0
47489 22M 0
47548 22M 0
47561 22M 0
47562 22M 0
47588 22M 0
47589 22M 0
47590 22M 0
47591 22M 0
47592 22M 0
47593 22M 0
47594 22M 0
47595 22M 0
47596 22M 0
47606 22M 0
47607 22M 0
47608 22M 0
47609 22M 0
47610 22M 0
47611 22M 0
47612 22M 0
47613 22M 0
47614 22M 0
47615 22M 0
47627 22M 0
47636 22M 0
47640 22M 0
47641 22M 0
47644 22M 0
47646 22M 0
47683 22M 0
47684 22M 0
47685 22M 0
47686 22M 0
47688 22M 0
47690 22M 0
47691 22M 0
47700 22M 0
47701 22M 0
47702 22M 0
47703 22M 0
47704 22M 0
47705 22M 0
47706 22M 0
47707 22M 0
47745 32,22M 0
47781 22M 0
47782 22M 0
47783 22M 0
47784 22M 0
47785 22M 0
47786 22M 0
47787 22M 0
47788 22M 0
47789 22M 0
47790 22M 0
47791 22M 0
47792 22M 0
47793 22M 0
47794 22M 0
47795 22M 0
47796 22M 0
47797 22M 0
47798 22M 0
47799 22M 0
47800 22M 0
47801 22M 0
47802 22M 0
47803 22M 0
47804 22M 0
47805 22M 0
51279 22M 0