SELECT 
  `F`.`path`, 
  `PI`.`product_id`, 
  `PI`.`alt` 
FROM 
  `cscart_products__images` AS `PI` 
  LEFT JOIN `files` AS `F` ON `PI`.`watermark_small_file_id` = `F`.`id` 
WHERE 
  `PI`.`product_id` IN (
    '28868', '28885', '28870', '28872', 
    '28887'
  )

Query time 0.00040

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "7.20"
    },
    "nested_loop": [
      {
        "table": {
          "table_name": "PI",
          "access_type": "range",
          "possible_keys": [
            "product_id"
          ],
          "key": "product_id",
          "used_key_parts": [
            "product_id"
          ],
          "key_length": "3",
          "rows_examined_per_scan": 5,
          "rows_produced_per_join": 5,
          "filtered": "100.00",
          "index_condition": "(`dev2`.`PI`.`product_id` in ('28868','28885','28870','28872','28887'))",
          "cost_info": {
            "read_cost": "3.01",
            "eval_cost": "0.50",
            "prefix_cost": "3.51",
            "data_read_per_join": "160"
          },
          "used_columns": [
            "product_id",
            "watermark_small_file_id",
            "alt"
          ]
        }
      },
      {
        "table": {
          "table_name": "F",
          "access_type": "eq_ref",
          "possible_keys": [
            "PRIMARY"
          ],
          "key": "PRIMARY",
          "used_key_parts": [
            "id"
          ],
          "key_length": "4",
          "ref": [
            "dev2.PI.watermark_small_file_id"
          ],
          "rows_examined_per_scan": 1,
          "rows_produced_per_join": 5,
          "filtered": "100.00",
          "cost_info": {
            "read_cost": "3.19",
            "eval_cost": "0.50",
            "prefix_cost": "7.20",
            "data_read_per_join": "18K"
          },
          "used_columns": [
            "id",
            "path"
          ]
        }
      }
    ]
  }
}

Result

path product_id alt
https://s3.timeweb.cloud/482029f9-prod/products__images/28868_ac4f18a13456_28869_cd9b21743b52_0_f44e08182090_ustanovka-gnb-xcmg-xz120e-1_1.webp 28868
https://s3.timeweb.cloud/482029f9-prod/products__images/28870_0e3bfa06c5bd_28871_5c6416f13994_0_2f445fde635b_25be83217acdb20e06b6d8eb1dddc24b.webp 28870
https://s3.timeweb.cloud/482029f9-prod/products__images/28872_102a69354b71_28873_0927bf2302d9_0_6eab632fb703_gen1200.webp 28872
https://s3.timeweb.cloud/482029f9-prod/products__images/28885_c3215e5b2d0d_28886_ada3b911aee1_0_512abf094416_%2525D0%252598%2525D0%2525B7%2525D0%2525BE%2525D0%2525B1%2525D1%252580%2525D0%2525B0%2525D0%2525B6%2525D0%2525B5%2525D0%2525BD%2525D0%2525B8%2525D0%2525B5%252520WhatsApp%2525202024-12-20%252520%2525D0%2525B2%25252009.52.06_0b95b791.webp 28885
https://s3.timeweb.cloud/482029f9-prod/products__images/28887_0fd1621ee5d5_28888_9a947bf8dd22_0_8f124cf3ebb1_DeWatermark.ai_1734670654831.webp 28887