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 (28629, 30294, 30298, 30808, 12449)

Query time 0.00050

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "10.71"
    },
    "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": 8,
          "rows_produced_per_join": 8,
          "filtered": "100.00",
          "index_condition": "(`dev2`.`PI`.`product_id` in (28629,30294,30298,30808,12449))",
          "cost_info": {
            "read_cost": "4.06",
            "eval_cost": "0.80",
            "prefix_cost": "4.86",
            "data_read_per_join": "256"
          },
          "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": 8,
          "filtered": "100.00",
          "cost_info": {
            "read_cost": "5.05",
            "eval_cost": "0.80",
            "prefix_cost": "10.71",
            "data_read_per_join": "29K"
          },
          "used_columns": [
            "id",
            "path"
          ]
        }
      }
    ]
  }
}

Result

path product_id alt
https://s3.timeweb.cloud/482029f9-prod/products__images/12449_c50a0b3e8d03_gaz.webp 12449
https://s3.timeweb.cloud/482029f9-prod/products__images/28629_5adbbb400e8a_28763_6b600ea35549_28629_b9f2accea58d_28630_ae18e334967f_%252525D0%252525A0%252525D0%252525B5%252525D1%25252584-1.webp 28629
https://s3.timeweb.cloud/482029f9-prod/products__images/28629_d8805b5979ac_28763_b6b1c6391420_28629_ae1522a69926_28630_cfb122609276_%252525D0%252525A0%252525D0%252525B5%252525D1%25252584-2.webp 28629
https://s3.timeweb.cloud/482029f9-prod/products__images/30294_dd414aedf1e7_30769_35925b23be2e_30294_9e405272a25b_30756_d5f5affcb114_30294_97f75a7ee963_30295_c810f99d8faf_0_ce527c387fc4_IMG_20240821_113851.webp 30294
https://s3.timeweb.cloud/482029f9-prod/products__images/30298_8ccc4f3faf74_30770_dda3da2ca4e9_30298_5183b03d5a9d_30755_be79ecea27ea_30298_564a59071f3c_30299_5cd5931049ed_0_56d13785a782_IMG_20240821_110334.webp 30298
https://s3.timeweb.cloud/482029f9-prod/products__images/30808_3e4f98498bd0_30809_e99e5030d342_0_0efed9ad044f_IMG_20241119_113456.webp 30808
https://s3.timeweb.cloud/482029f9-prod/products__images/30808_bb6b238404e2_30809_d4016af5c399_0_9abe219f7bc1_IMG_20241119_113512.webp 30808
https://s3.timeweb.cloud/482029f9-prod/products__images/30808_62e7e3c84779_30809_14148f4df619_0_2e67ae6eec25_IMG_20241119_113432.webp 30808