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 = 7158 
WHERE 
  cscart_products_categories.product_id IN (
    95928, 95929, 95930, 95931, 96490, 96491, 
    96492, 96493, 96494, 96495, 96496, 
    96497, 96498, 96499, 96500, 96501, 
    96502, 96503, 96504, 96505, 96506, 
    96507, 96509, 96531, 96532, 96533, 
    96534, 96535, 96536, 96562, 96563, 
    96630, 96631, 96632, 96633, 96634, 
    96635, 96636, 96637, 96638, 96639, 
    96640, 96641, 96642, 96643, 96644, 
    96645, 96646, 96647, 96648, 96649, 
    96650, 96651, 96652, 96653, 96654, 
    96655, 96656, 96657, 96658, 96659, 
    96660, 96661, 96662, 96663, 96664, 
    96665, 96666, 96667, 96695, 96696, 
    96697, 97581, 97743, 97744, 97745, 
    97746, 97747, 97748, 97749, 97750, 
    97751, 97752, 97753, 97754, 97755, 
    97756, 97757, 97758, 97759, 97760, 
    97761, 97762, 97763, 97764, 97795
  ) 
GROUP BY 
  cscart_products_categories.product_id

Query time 0.01444

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "104.70"
    },
    "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": 116,
            "rows_produced_per_join": 116,
            "filtered": "100.00",
            "using_index": true,
            "cost_info": {
              "read_cost": "11.90",
              "eval_cost": "11.60",
              "prefix_cost": "23.50",
              "data_read_per_join": "1K"
            },
            "used_columns": [
              "product_id",
              "category_id",
              "link_type"
            ],
            "attached_condition": "(`nuie_scalesta_net`.`cscart_products_categories`.`product_id` in (95928,95929,95930,95931,96490,96491,96492,96493,96494,96495,96496,96497,96498,96499,96500,96501,96502,96503,96504,96505,96506,96507,96509,96531,96532,96533,96534,96535,96536,96562,96563,96630,96631,96632,96633,96634,96635,96636,96637,96638,96639,96640,96641,96642,96643,96644,96645,96646,96647,96648,96649,96650,96651,96652,96653,96654,96655,96656,96657,96658,96659,96660,96661,96662,96663,96664,96665,96666,96667,96695,96696,96697,97581,97743,97744,97745,97746,97747,97748,97749,97750,97751,97752,97753,97754,97755,97756,97757,97758,97759,97760,97761,97762,97763,97764,97795))"
          }
        },
        {
          "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": 116,
            "filtered": "100.00",
            "cost_info": {
              "read_cost": "29.00",
              "eval_cost": "11.60",
              "prefix_cost": "64.10",
              "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": 5,
            "filtered": "5.00",
            "cost_info": {
              "read_cost": "29.00",
              "eval_cost": "0.58",
              "prefix_cost": "104.70",
              "data_read_per_join": "15K"
            },
            "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
95928 7247M,7265
95929 7247M,7265
95930 7247M,7265
95931 7247M,7265
96490 7263M
96491 7263M
96492 7263M
96493 7263M
96494 7247M,7265
96495 7247M,7265
96496 7247M,7265
96497 7247M,7265
96498 7247M,7265
96499 7247M,7265
96500 7247M,7265
96501 7247M,7265
96502 7247M,7265
96503 7247M,7265
96504 7247M,7265
96505 7247M,7265
96506 7247M,7265
96507 7247M,7265
96509 7247M,7265
96531 7263M
96532 7263M
96533 7263M
96534 7263M
96535 7263M
96536 7263M
96562 7263M
96563 7263M
96630 7263M
96631 7263M
96632 7263M
96633 7263M
96634 7263M
96635 7263M
96636 7263M
96637 7263M
96638 7263M
96639 7263M
96640 7263M
96641 7263M
96642 7263M
96643 7263M
96644 7263M
96645 7263M
96646 7263M
96647 7263M
96648 7263M
96649 7263M
96650 7263M
96651 7263M
96652 7263M
96653 7263M
96654 7263M
96655 7263M
96656 7263M
96657 7263M
96658 7263M
96659 7263M
96660 7263M
96661 7263M
96662 7263M
96663 7263M
96664 7263M
96665 7263M
96666 7263M
96667 7263M
96695 7263M
96696 7263M
96697 7263M
97581 7247M,7265
97743 7263M
97744 7263M
97745 7263M
97746 7263M
97747 7263M
97748 7263M
97749 7263M
97750 7263M
97751 7263M
97752 7263M
97753 7263M
97754 7263M
97755 7263M
97756 7263M
97757 7263M
97758 7263M
97759 7263M
97760 7263M
97761 7263M
97762 7263M
97763 7263M
97764 7263M
97795 7263M