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 = 7168 
WHERE 
  cscart_products_categories.product_id IN (
    96932, 96933, 96934, 96935, 96936, 96937, 
    96938, 96939, 96940, 96941, 96942, 
    96943, 96944, 96945, 96946, 96947, 
    96948, 96949, 96950, 96951, 96952, 
    96953, 96954, 96955, 96956, 96957, 
    96958, 96959, 96960, 96961, 96962, 
    96963, 96964, 96965, 96966, 96967, 
    96968, 96969, 96970, 96971, 96972, 
    96973, 96974, 96975, 96976, 96977, 
    96978, 96979, 96980, 98509, 98510, 
    98511, 98512, 98513, 98514, 98516, 
    98517, 98518, 98519, 98520, 98889, 
    98890, 98891, 98892, 98893, 98894, 
    98895, 98896, 98898, 98899, 98900, 
    98901, 98902, 98903, 98904, 98905, 
    98906, 98907, 98908, 98909, 100181, 
    100182, 100183, 100184, 100185, 100186, 
    100187, 100188, 100189, 100190, 100191, 
    100192, 100193, 100194, 100195, 100196
  ) 
GROUP BY 
  cscart_products_categories.product_id

Query time 0.00194

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 (96932,96933,96934,96935,96936,96937,96938,96939,96940,96941,96942,96943,96944,96945,96946,96947,96948,96949,96950,96951,96952,96953,96954,96955,96956,96957,96958,96959,96960,96961,96962,96963,96964,96965,96966,96967,96968,96969,96970,96971,96972,96973,96974,96975,96976,96977,96978,96979,96980,98509,98510,98511,98512,98513,98514,98516,98517,98518,98519,98520,98889,98890,98891,98892,98893,98894,98895,98896,98898,98899,98900,98901,98902,98903,98904,98905,98906,98907,98908,98909,100181,100182,100183,100184,100185,100186,100187,100188,100189,100190,100191,100192,100193,100194,100195,100196))"
          }
        },
        {
          "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
96932 7176M
96933 7176M
96934 7174M
96935 7174M
96936 7174M
96937 7174M
96938 7174M
96939 7174M
96940 7174M
96941 7174M
96942 7176M
96943 7176M
96944 7176M
96945 7176M
96946 7176M
96947 7176M
96948 7179M
96949 7179M
96950 7179M
96951 7176M
96952 7176M
96953 7176M
96954 7179M
96955 7179M
96956 7179M
96957 7179M
96958 7179M
96959 7173M
96960 7173M
96961 7173M
96962 7173M
96963 7173M
96964 7173M
96965 7173M
96966 7173M
96967 7173M
96968 7173M
96969 7177M
96970 7177M
96971 7177M
96972 7177M
96973 7177M
96974 7177M
96975 7177M
96976 7177M
96977 7177M
96978 7177M
96979 7177M
96980 7177M
98509 7172M
98510 7172M
98511 7169M
98512 7175M
98513 7175M
98514 7175M
98516 7177M
98517 7173M
98518 7173M
98519 7173M
98520 7173M
98889 7176M
98890 7176M
98891 7177M
98892 7179M
98893 7173M
98894 7177M
98895 7177M
98896 7177M
98898 7173M
98899 7173M
98900 7176M
98901 7173M
98902 7176M
98903 7176M
98904 7179M
98905 7173M
98906 7174M
98907 7174M
98908 7174M
98909 7174M
100181 7168M 0
100182 7168M 0
100183 7168M 0
100184 7168M 0
100185 7168M 0
100186 7168M 0
100187 7172M
100188 7172M
100189 7172M
100190 7172M
100191 7172M
100192 7168M 0
100193 7168M 0
100194 7168M 0
100195 7172M
100196 7172M