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 = 7234 
WHERE 
  cscart_products_categories.product_id IN (
    96453, 96454, 96455, 96456, 96457, 96458, 
    96459, 96460, 96461, 96462, 96463, 
    96464, 96465, 96466, 96467, 96468, 
    96469, 96470, 96471, 96472, 96473, 
    96474, 98602, 98606, 98608, 98610, 
    98625, 98627, 98629, 98634, 98636, 
    98638, 98642, 98643, 98648, 98654, 
    98655, 98656, 98660, 98662, 98664, 
    98670, 99704, 99705, 99717, 99718, 
    99720, 99839, 99840, 99841, 99842, 
    99844, 99847, 99849, 99851, 99854, 
    99856, 99858, 99859, 99861, 99863, 
    99864, 99866, 99868, 99870, 99871, 
    99873, 99876, 99878, 99881, 99883, 
    99893, 99894, 99897, 99898, 99901, 
    99902, 99905, 99906, 99909, 99910, 
    99913, 99914, 99917, 99918, 99932, 
    99934, 99938, 99940, 99942, 99948, 
    99950, 99956, 99958, 99962, 99964
  ) 
GROUP BY 
  cscart_products_categories.product_id

Query time 0.00092

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "54.77"
    },
    "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": 96,
            "rows_produced_per_join": 96,
            "filtered": "100.00",
            "using_index": true,
            "cost_info": {
              "read_cost": "9.89",
              "eval_cost": "9.60",
              "prefix_cost": "19.49",
              "data_read_per_join": "1K"
            },
            "used_columns": [
              "product_id",
              "category_id",
              "link_type"
            ],
            "attached_condition": "(`nuie_scalesta_net`.`cscart_products_categories`.`product_id` in (96453,96454,96455,96456,96457,96458,96459,96460,96461,96462,96463,96464,96465,96466,96467,96468,96469,96470,96471,96472,96473,96474,98602,98606,98608,98610,98625,98627,98629,98634,98636,98638,98642,98643,98648,98654,98655,98656,98660,98662,98664,98670,99704,99705,99717,99718,99720,99839,99840,99841,99842,99844,99847,99849,99851,99854,99856,99858,99859,99861,99863,99864,99866,99868,99870,99871,99873,99876,99878,99881,99883,99893,99894,99897,99898,99901,99902,99905,99906,99909,99910,99913,99914,99917,99918,99932,99934,99938,99940,99942,99948,99950,99956,99958,99962,99964))"
          }
        },
        {
          "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": 4,
            "filtered": "5.00",
            "cost_info": {
              "read_cost": "24.00",
              "eval_cost": "0.48",
              "prefix_cost": "53.09",
              "data_read_per_join": "12K"
            },
            "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": "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": 4,
            "filtered": "100.00",
            "cost_info": {
              "read_cost": "1.20",
              "eval_cost": "0.48",
              "prefix_cost": "54.77",
              "data_read_per_join": "76"
            },
            "used_columns": [
              "product_id",
              "category_id",
              "position"
            ]
          }
        }
      ]
    }
  }
}

Result

product_id category_ids position
96453 7234M 0
96454 7234M 0
96455 7234M 0
96456 7234M 0
96457 7234M 0
96458 7234M 0
96459 7234M 0
96460 7234M 0
96461 7234M 0
96462 7234M 0
96463 7234M 0
96464 7234M 0
96465 7234M 0
96466 7234M 0
96467 7234M 0
96468 7234M 0
96469 7234M 0
96470 7234M 0
96471 7234M 0
96472 7234M 0
96473 7234M 0
96474 7234M 0
98602 7234M 0
98606 7234M 0
98608 7234M 0
98610 7234M 0
98625 7234M 0
98627 7234M 0
98629 7234M 0
98634 7234M 0
98636 7234M 0
98638 7234M 0
98642 7234M 0
98643 7234M 0
98648 7234M 0
98654 7234M 0
98655 7234M 0
98656 7234M 0
98660 7234M 0
98662 7234M 0
98664 7234M 0
98670 7234M 0
99704 7234M 0
99705 7234M 0
99717 7234M 0
99718 7234M 0
99720 7234M 0
99839 7234M 0
99840 7234M 0
99841 7234M 0
99842 7234M 0
99844 7234M 0
99847 7234M 0
99849 7234M 0
99851 7234M 0
99854 7234M 0
99856 7234M 0
99858 7234M 0
99859 7234M 0
99861 7234M 0
99863 7234M 0
99864 7234M 0
99866 7234M 0
99868 7234M 0
99870 7234M 0
99871 7234M 0
99873 7234M 0
99876 7234M 0
99878 7234M 0
99881 7234M 0
99883 7234M 0
99893 7234M 0
99894 7234M 0
99897 7234M 0
99898 7234M 0
99901 7234M 0
99902 7234M 0
99905 7234M 0
99906 7234M 0
99909 7234M 0
99910 7234M 0
99913 7234M 0
99914 7234M 0
99917 7234M 0
99918 7234M 0
99932 7234M 0
99934 7234M 0
99938 7234M 0
99940 7234M 0
99942 7234M 0
99948 7234M 0
99950 7234M 0
99956 7234M 0
99958 7234M 0
99962 7234M 0
99964 7234M 0