SELECT 
  category_id, 
  parent_id 
FROM 
  categories 
WHERE 
  parent_id IN(
    23245, 23251, 23244, 23243, 21737, 17295, 
    9662, 16788, 14608, 10407, 1329, 1123, 
    20529, 11840, 1326, 687, 20534, 1327, 
    18962, 20536, 509, 14866, 19037, 20533, 
    7460, 9505, 20532, 508, 20537, 7848, 
    3206, 507, 3212, 16952, 3216, 20535, 
    1072, 1330, 3352, 20530, 1334, 3210, 
    1332, 3215, 1333, 3208, 9500, 2410, 
    8997, 9604, 410, 511, 510, 16473, 16819, 
    8497, 1328, 16953, 3397, 9605, 513, 
    1301, 540, 23227
  )

Query time 0.00134

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "21.92"
    },
    "table": {
      "table_name": "categories",
      "access_type": "range",
      "possible_keys": [
        "parent"
      ],
      "key": "parent",
      "used_key_parts": [
        "parent_id"
      ],
      "key_length": "3",
      "rows_examined_per_scan": 106,
      "rows_produced_per_join": 106,
      "filtered": "100.00",
      "using_index": true,
      "cost_info": {
        "read_cost": "11.32",
        "eval_cost": "10.60",
        "prefix_cost": "21.92",
        "data_read_per_join": "277K"
      },
      "used_columns": [
        "category_id",
        "parent_id"
      ],
      "attached_condition": "(`goimagine`.`categories`.`parent_id` in (23245,23251,23244,23243,21737,17295,9662,16788,14608,10407,1329,1123,20529,11840,1326,687,20534,1327,18962,20536,509,14866,19037,20533,7460,9505,20532,508,20537,7848,3206,507,3212,16952,3216,20535,1072,1330,3352,20530,1334,3210,1332,3215,1333,3208,9500,2410,8997,9604,410,511,510,16473,16819,8497,1328,16953,3397,9605,513,1301,540,23227))"
    }
  }
}

Result

category_id parent_id
5497 410
5498 410
594 507
1076 508
1326 1328
1327 1328
1329 1328
1330 1328
1332 1328
1333 1328
1334 1328
7848 1328
9505 1328
14866 1328
507 2410
508 2410
509 2410
687 2410
1072 2410
1123 2410
3352 2410
7460 2410
8497 2410
19037 2410
511 9605
9604 9605
9662 9605
10407 9605
14608 9605
16788 9605
20529 16819
20530 16819
20532 16819
20533 16819
20534 16819
20535 16819
20536 16819
20537 16819
21737 16819
540 16952
1301 16952
2410 16952
3397 16952
8997 16952
9500 16952
410 16953
510 16953
513 16953
9605 16953
16473 16953
17295 16953
23243 18962
23228 23227
23245 23244