SELECT 
  category_id, 
  parent_id 
FROM 
  netting_categories 
WHERE 
  parent_id IN(
    297, 
    366, 
    401, 
    382, 
    276, 
    290, 
    335, 
    361, 
    392, 
    434, 
    419, 
    369, 
    416, 
    378, 
    274, 
    451, 
    331, 
    347, 
    444, 
    373, 
    376, 
    304, 
    275, 
    310, 
    447, 
    383, 
    265, 
    282, 
    381, 
    400, 
    384, 
    334, 
    441, 
    333, 
    348, 
    368, 
    420, 
    364, 
    354, 
    362, 
    438, 
    277, 
    266, 
    437, 
    291, 
    457, 
    305, 
    337, 
    435, 
    443, 
    442, 
    267, 
    283, 
    452, 
    356, 
    427, 
    385, 
    389, 
    336, 
    374, 
    377, 
    298, 
    445, 
    446, 
    449, 
    417, 
    379, 
    418, 
    370, 
    367, 
    349, 
    455, 
    363, 
    284, 
    312, 
    278, 
    439, 
    338, 
    299, 
    428, 
    380, 
    306, 
    292, 
    440, 
    390, 
    453, 
    371, 
    365, 
    386, 
    350, 
    357, 
    355, 
    375, 
    342, 
    268, 
    436, 
    421, 
    387, 
    429, 
    358, 
    422, 
    285, 
    339, 
    269, 
    293, 
    372, 
    279, 
    300, 
    343, 
    351, 
    307, 
    314, 
    294, 
    430, 
    359, 
    340, 
    301, 
    344, 
    308, 
    270, 
    280, 
    388, 
    352, 
    286, 
    423, 
    271, 
    281, 
    309, 
    360, 
    302, 
    341, 
    424, 
    315, 
    353, 
    431, 
    287, 
    295, 
    345, 
    303, 
    432, 
    272, 
    425, 
    288, 
    316, 
    346, 
    296, 
    433, 
    289, 
    317, 
    318, 
    319, 
    394, 
    399, 
    466, 
    464, 
    320, 
    465, 
    273, 
    321, 
    322, 
    323, 
    324, 
    325, 
    326, 
    327, 
    328, 
    329, 
    330, 
    426, 
    450, 
    448, 
    462, 
    454, 
    458, 
    456, 
    461, 
    459, 
    460
  ) 
  AND category_id != 264

Query time 0.00095

JSON explain

{
  "query_block": {
    "select_id": 1,
    "nested_loop": [
      {
        "table": {
          "table_name": "netting_categories",
          "access_type": "ALL",
          "possible_keys": ["PRIMARY", "parent", "p_category_id"],
          "rows": 180,
          "filtered": 100,
          "attached_condition": "netting_categories.parent_id in (297,366,401,382,276,290,335,361,392,434,419,369,416,378,274,451,331,347,444,373,376,304,275,310,447,383,265,282,381,400,384,334,441,333,348,368,420,364,354,362,438,277,266,437,291,457,305,337,435,443,442,267,283,452,356,427,385,389,336,374,377,298,445,446,449,417,379,418,370,367,349,455,363,284,312,278,439,338,299,428,380,306,292,440,390,453,371,365,386,350,357,355,375,342,268,436,421,387,429,358,422,285,339,269,293,372,279,300,343,351,307,314,294,430,359,340,301,344,308,270,280,388,352,286,423,271,281,309,360,302,341,424,315,353,431,287,295,345,303,432,272,425,288,316,346,296,433,289,317,318,319,394,399,466,464,320,465,273,321,322,323,324,325,326,327,328,329,330,426,450,448,462,454,458,456,461,459,460) and netting_categories.category_id <> 264"
        }
      }
    ]
  }
}

Result

category_id parent_id
348 347
336 335
337 336
305 304
298 297
291 290
283 282
277 276
266 265
267 266
349 348
354 347
356 355
362 361
364 362
367 366
368 367
370 369
374 373
377 376
379 378
385 384
389 386
417 416
418 417
420 419
427 274
435 434
437 427
438 437
442 441
443 442
445 444
446 315
449 448
452 275
455 382
457 401
453 366
342 335
338 336
312 310
306 304
299 297
292 290
284 282
278 276
268 266
350 348
355 347
357 355
363 361
365 362
371 369
375 373
380 378
386 384
390 386
421 419
428 274
436 434
439 437
440 427
343 335
339 336
307 304
300 297
293 290
279 276
285 282
269 266
351 348
358 355
372 369
387 384
422 419
429 274
344 335
314 310
340 336
308 304
301 297
294 290
280 276
286 282
270 266
352 348
359 355
388 384
423 419
430 274
345 335
315 310
341 336
309 304
302 297
295 290
287 282
281 276
271 266
353 348
360 355
424 419
431 274
346 335
316 310
303 297
296 290
288 282
272 266
425 419
432 274
317 310
289 282
433 274
318 310
319 310
464 331
320 310
394 310
399 310
465 331
321 310
273 266
322 310
323 310
324 310
325 310
326 310
327 310
328 310
329 310
330 310
426 419
448 447
450 448
454 366
462 282
456 382
458 401
459 392
461 331
460 392