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 = 7151 
WHERE 
  cscart_products_categories.product_id IN (
    92557, 91938, 91937, 91939, 91940, 91941, 
    91942, 91943, 82403, 82410, 82424, 
    82362, 82360, 82404, 82342, 82367, 
    82338, 82337, 89595, 89596, 89597, 
    82336, 91936, 86810, 82375, 89590, 
    89589, 86806, 86809, 94023, 94696, 
    94697, 96295, 96298, 96708, 96718, 
    96719, 96720, 96724, 96734, 96735, 
    96738, 96743, 96758, 96759, 96764, 
    96775, 97820, 97821, 98258, 98259, 
    98260, 98261, 98262, 98263, 98264, 
    98265, 98690, 98693, 98694, 100374, 
    100375, 100380, 100381, 100382, 100383, 
    100598, 100601, 101635, 101636, 101639, 
    101640, 101644, 101645, 101646, 101647, 
    101648, 101649, 101650, 101651, 101652, 
    101653
  ) 
GROUP BY 
  cscart_products_categories.product_id

Query time 0.02477

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "130.36"
    },
    "grouping_operation": {
      "using_temporary_table": true,
      "using_filesort": true,
      "cost_info": {
        "sort_cost": "6.38"
      },
      "nested_loop": [
        {
          "table": {
            "table_name": "cscart_categories",
            "access_type": "ALL",
            "possible_keys": [
              "PRIMARY",
              "c_status",
              "p_category_id"
            ],
            "rows_examined_per_scan": 208,
            "rows_produced_per_join": 8,
            "filtered": "4.00",
            "cost_info": {
              "read_cost": "20.72",
              "eval_cost": "0.83",
              "prefix_cost": "21.55",
              "data_read_per_join": "21K"
            },
            "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')))"
          }
        },
        {
          "table": {
            "table_name": "cscart_products_categories",
            "access_type": "ref",
            "possible_keys": [
              "PRIMARY",
              "link_type",
              "pt"
            ],
            "key": "PRIMARY",
            "used_key_parts": [
              "category_id"
            ],
            "key_length": "3",
            "ref": [
              "nuie_scalesta_net.cscart_categories.category_id"
            ],
            "rows_examined_per_scan": 117,
            "rows_produced_per_join": 6,
            "filtered": "0.65",
            "cost_info": {
              "read_cost": "2.33",
              "eval_cost": "0.64",
              "prefix_cost": "121.75",
              "data_read_per_join": "102"
            },
            "used_columns": [
              "product_id",
              "category_id",
              "link_type"
            ],
            "attached_condition": "(`nuie_scalesta_net`.`cscart_products_categories`.`product_id` in (92557,91938,91937,91939,91940,91941,91942,91943,82403,82410,82424,82362,82360,82404,82342,82367,82338,82337,89595,89596,89597,82336,91936,86810,82375,89590,89589,86806,86809,94023,94696,94697,96295,96298,96708,96718,96719,96720,96724,96734,96735,96738,96743,96758,96759,96764,96775,97820,97821,98258,98259,98260,98261,98262,98263,98264,98265,98690,98693,98694,100374,100375,100380,100381,100382,100383,100598,100601,101635,101636,101639,101640,101644,101645,101646,101647,101648,101649,101650,101651,101652,101653))"
          }
        },
        {
          "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": 6,
            "filtered": "100.00",
            "cost_info": {
              "read_cost": "1.59",
              "eval_cost": "0.64",
              "prefix_cost": "123.98",
              "data_read_per_join": "102"
            },
            "used_columns": [
              "product_id",
              "category_id",
              "position"
            ]
          }
        }
      ]
    }
  }
}

Result

product_id category_ids position
82336 7151M,7301 0
82337 7151M,7301 0
82338 7151M,7301 0
82342 7151M,7301 0
82360 7151M,7301 0
82362 7151M,7301 0
82367 7151M,7301 0
82375 7151M,7301 0
82403 7151M,7301 0
82404 7151M,7301 0
82410 7151M,7301 0
82424 7151M,7301 0
86806 7151M,7301 0
86809 7151M,7301 0
86810 7151M,7301 0
89589 7151M,7301 0
89590 7151M,7301 0
89595 7151M,7301 0
89596 7151M,7301 0
89597 7151M,7301 0
91936 7151M,7301 0
91937 7151M,7301 0
91938 7151M,7301 0
91939 7151M,7301 0
91940 7151M,7301 0
91941 7151M,7301 0
91942 7151M,7301 0
91943 7151M,7301 0
92557 7151M,7301 0
94023 7151M,7301 0
94696 7151M,7301 0
94697 7151M,7301 0
96295 7151M,7301 0
96298 7151M,7301 0
96708 7151M,7301 0
96718 7151M,7301 0
96719 7151M,7301 0
96720 7151M,7301 0
96724 7151M,7301 0
96734 7151M,7301 0
96735 7151M,7301 0
96738 7151M,7301 0
96743 7151M,7301 0
96758 7151M,7301 0
96759 7151M,7301 0
96764 7151M,7301 0
96775 7151M,7301 0
97820 7151M,7301 0
97821 7151M,7301 0
98258 7151M,7301 0
98259 7151M,7301 0
98260 7151M,7301 0
98261 7151M,7301 0
98262 7151M,7301 0
98263 7151M,7301 0
98264 7151M,7301 0
98265 7151M,7301 0
98690 7151M,7301 0
98693 7151M,7301 0
98694 7151M,7301 0
100374 7151M,7301 0
100375 7151M,7301 0
100380 7151M,7301 0
100381 7151M,7301 0
100382 7151M,7301 0
100383 7151M,7301 0
100598 7151M,7301 0
100601 7151M,7301 0
101635 7151M,7301 0
101636 7151M,7301 0
101639 7151M,7301 0
101640 7151M,7301 0
101644 7151M,7301 0
101645 7151M,7301 0
101646 7151M,7301 0
101647 7151M,7301 0
101648 7151M,7301 0
101649 7151M,7301 0
101650 7151M,7301 0
101651 7151M,7301 0
101652 7151M,7301 0
101653 7151M,7301 0