SELECT 
  category_id, 
  parent_id 
FROM 
  categories 
WHERE 
  parent_id IN(
    1331, 838, 845, 839, 862, 841, 843, 861, 
    847, 1324, 860, 846, 856, 859, 851, 852, 
    864, 840, 844, 863, 1323, 850, 848, 865, 
    857, 1337, 842
  )

Query time 0.00077

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "7.48"
    },
    "table": {
      "table_name": "categories",
      "access_type": "range",
      "possible_keys": [
        "parent"
      ],
      "key": "parent",
      "used_key_parts": [
        "parent_id"
      ],
      "key_length": "3",
      "rows_examined_per_scan": 34,
      "rows_produced_per_join": 34,
      "filtered": "100.00",
      "using_index": true,
      "cost_info": {
        "read_cost": "4.09",
        "eval_cost": "3.40",
        "prefix_cost": "7.49",
        "data_read_per_join": "88K"
      },
      "used_columns": [
        "category_id",
        "parent_id"
      ],
      "attached_condition": "(`goimagine`.`categories`.`parent_id` in (1331,838,845,839,862,841,843,861,847,1324,860,846,856,859,851,852,864,840,844,863,1323,850,848,865,857,1337,842))"
    }
  }
}

Result

category_id parent_id
865 838
848 839
861 839
852 840
850 843
856 843
857 843
858 846
859 846
860 846
862 851
863 851
864 851