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 = 7237 
WHERE 
  cscart_products_categories.product_id IN (
    100579, 100580, 100581, 100582, 100583, 
    100584, 100585, 100586, 100587, 100588, 
    100589, 100590, 100591, 100592, 100593, 
    101047, 101048, 101049, 101050, 101051, 
    101052, 101053, 101574, 101575, 101576, 
    101577, 101578, 101579, 101580, 101581, 
    101582, 101583, 101584, 101585, 101586, 
    101587, 101588, 101589, 101590, 101591, 
    101592, 101593, 101594, 101595, 101596, 
    101597, 101598, 101599, 101600, 101601, 
    101602, 101603, 101604, 101605, 101606, 
    101607, 101608, 101609, 101610, 101611, 
    101612, 101613, 101614, 101615, 101616, 
    101617, 101618, 101619, 101620, 101621, 
    101622, 101623, 101624
  ) 
GROUP BY 
  cscart_products_categories.product_id

Query time 0.01521

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "65.99"
    },
    "grouping_operation": {
      "using_filesort": false,
      "nested_loop": [
        {
          "table": {
            "table_name": "cscart_products_categories",
            "access_type": "range",
            "possible_keys": [
              "PRIMARY",
              "link_type",
              "pt"
            ],
            "key": "pt",
            "used_key_parts": [
              "product_id"
            ],
            "key_length": "3",
            "rows_examined_per_scan": 73,
            "rows_produced_per_join": 73,
            "filtered": "100.00",
            "using_index": true,
            "cost_info": {
              "read_cost": "7.59",
              "eval_cost": "7.30",
              "prefix_cost": "14.89",
              "data_read_per_join": "1K"
            },
            "used_columns": [
              "product_id",
              "category_id",
              "link_type"
            ],
            "attached_condition": "(`nuie_scalesta_net`.`cscart_products_categories`.`product_id` in (100579,100580,100581,100582,100583,100584,100585,100586,100587,100588,100589,100590,100591,100592,100593,101047,101048,101049,101050,101051,101052,101053,101574,101575,101576,101577,101578,101579,101580,101581,101582,101583,101584,101585,101586,101587,101588,101589,101590,101591,101592,101593,101594,101595,101596,101597,101598,101599,101600,101601,101602,101603,101604,101605,101606,101607,101608,101609,101610,101611,101612,101613,101614,101615,101616,101617,101618,101619,101620,101621,101622,101623,101624))"
          }
        },
        {
          "table": {
            "table_name": "product_position_source",
            "access_type": "eq_ref",
            "possible_keys": [
              "PRIMARY",
              "pt"
            ],
            "key": "PRIMARY",
            "used_key_parts": [
              "category_id",
              "product_id"
            ],
            "key_length": "6",
            "ref": [
              "const",
              "nuie_scalesta_net.cscart_products_categories.product_id"
            ],
            "rows_examined_per_scan": 1,
            "rows_produced_per_join": 73,
            "filtered": "100.00",
            "cost_info": {
              "read_cost": "18.25",
              "eval_cost": "7.30",
              "prefix_cost": "40.44",
              "data_read_per_join": "1K"
            },
            "used_columns": [
              "product_id",
              "category_id",
              "position"
            ]
          }
        },
        {
          "table": {
            "table_name": "cscart_categories",
            "access_type": "eq_ref",
            "possible_keys": [
              "PRIMARY",
              "c_status",
              "p_category_id"
            ],
            "key": "PRIMARY",
            "used_key_parts": [
              "category_id"
            ],
            "key_length": "3",
            "ref": [
              "nuie_scalesta_net.cscart_products_categories.category_id"
            ],
            "rows_examined_per_scan": 1,
            "rows_produced_per_join": 3,
            "filtered": "5.00",
            "cost_info": {
              "read_cost": "18.25",
              "eval_cost": "0.37",
              "prefix_cost": "65.99",
              "data_read_per_join": "9K"
            },
            "used_columns": [
              "category_id",
              "usergroup_ids",
              "status",
              "storefront_id"
            ],
            "attached_condition": "((`nuie_scalesta_net`.`cscart_categories`.`storefront_id` in (0,1)) and ((`nuie_scalesta_net`.`cscart_categories`.`usergroup_ids` = '') or (0 <> find_in_set(0,`nuie_scalesta_net`.`cscart_categories`.`usergroup_ids`)) or (0 <> find_in_set(1,`nuie_scalesta_net`.`cscart_categories`.`usergroup_ids`))) and (`nuie_scalesta_net`.`cscart_categories`.`status` in ('A','H')))"
          }
        }
      ]
    }
  }
}

Result

product_id category_ids position
100579 7270M
100580 7270M
100581 7270M
100582 7268M
100583 7268M
100584 7268M
100585 7268M
100586 7270M
100587 7270M
100588 7270M
100589 7272M
100590 7272M
100591 7270M
100592 7268M
100593 7274M
101047 7239M
101048 7239M
101049 7239M
101050 7239M
101051 7239M
101052 7239M
101053 7239M
101574 7268M
101575 7274M
101576 7270M
101577 7270M
101578 7270M
101579 7272M
101580 7272M
101581 7270M
101582 7270M
101583 7270M
101584 7270M
101585 7270M
101586 7270M
101587 7270M
101588 7270M
101589 7272M
101590 7272M
101591 7270M
101592 7272M
101593 7272M
101594 7270M
101595 7270M
101596 7270M
101597 7270M
101598 7270M
101599 7270M
101600 7270M
101601 7270M
101602 7270M
101603 7270M
101604 7270M
101605 7270M
101606 7270M
101607 7270M
101608 7270M
101609 7270M
101610 7270M
101611 7270M
101612 7268M
101613 7268M
101614 7268M
101615 7268M
101616 7270M
101617 7270M
101618 7270M
101619 7272M
101620 7272M
101621 7270M
101622 7268M
101623 7274M
101624 7272M