SELECT 
  category_id, 
  parent_id 
FROM 
  categories 
WHERE 
  parent_id IN(
    6817, 18879, 18881, 18878, 18880, 6365, 
    10333, 7712, 18857, 18877, 10335, 8443, 
    20143, 13358, 10812, 9321, 20955, 13357, 
    10334, 8499, 6866, 19803, 13628, 7905, 
    13359, 6358, 16173, 7714, 19514, 20611, 
    10336, 8695, 10409, 10161, 13356, 8031, 
    19509, 20302, 7713, 6483, 8489, 6247, 
    8488, 7265, 6368, 10482, 6369, 18886, 
    8694, 11350, 14094, 19515, 15466, 10853, 
    15094, 7695, 10163, 13321, 6366, 7266, 
    7221, 9148, 6370, 8498, 7405, 7710, 
    5843, 13579
  )

Query time 0.00214

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "32.51"
    },
    "table": {
      "table_name": "categories",
      "access_type": "range",
      "possible_keys": [
        "parent"
      ],
      "key": "parent",
      "used_key_parts": [
        "parent_id"
      ],
      "key_length": "3",
      "rows_examined_per_scan": 159,
      "rows_produced_per_join": 159,
      "filtered": "100.00",
      "using_index": true,
      "cost_info": {
        "read_cost": "16.61",
        "eval_cost": "15.90",
        "prefix_cost": "32.51",
        "data_read_per_join": "416K"
      },
      "used_columns": [
        "category_id",
        "parent_id"
      ],
      "attached_condition": "(`goimagine`.`categories`.`parent_id` in (6817,18879,18881,18878,18880,6365,10333,7712,18857,18877,10335,8443,20143,13358,10812,9321,20955,13357,10334,8499,6866,19803,13628,7905,13359,6358,16173,7714,19514,20611,10336,8695,10409,10161,13356,8031,19509,20302,7713,6483,8489,6247,8488,7265,6368,10482,6369,18886,8694,11350,14094,19515,15466,10853,15094,7695,10163,13321,6366,7266,7221,9148,6370,8498,7405,7710,5843,13579))"
    }
  }
}

Result

category_id parent_id
5844 5843
5845 5843
5846 5843
5847 5843
5848 5843
5849 5843
5850 5843
5851 5843
5852 5843
5855 5843
5856 5843
5857 5843
5858 5843
5859 5843
5861 5843
5862 5843
5863 5843
5864 5843
5865 5843
5866 5843
5867 5843
5868 5843
5869 5843
5870 5843
5871 5843
5873 5843
5874 5843
5875 5843
5876 5843
5877 5843
5878 5843
5879 5843
5880 5843
5881 5843
5882 5843
5883 5843
5884 5843
5885 5843
5886 5843
5887 5843
5888 5843
5889 5843
5890 5843
5891 5843
5895 5843
5929 5843
5930 5843
5931 5843
5932 5843
6365 5843
6367 5843
6368 5843
6369 5843
6471 5843
7932 5843
10333 5843
6866 6366
7265 6366
8488 6366
8489 6366
8499 6370
10482 6370
7712 7221
7713 7221
7714 7221
7379 7266
7905 7266
8031 7266
9321 7266
10811 7266
10812 7266
20143 7266
20611 7266
20954 7266
20955 7266
21066 7266
8694 7405
8695 7405
10334 7405
10335 7405
10336 7405
6247 7710
6358 7710
6483 7710
6903 8498
8443 8498
10161 8499
10409 9148
16173 9148
18857 9148
18877 9148
18886 9148
20302 10163
19509 11350
19514 11350
13356 13321
13357 13321
13358 13321
13359 13321
13360 13321
13628 13321
18878 18877
18879 18877
18880 18877
18881 18877
19803 19515