SELECT 
  PI.product_id, 
  F1.id AS file_id, 
  F1.path AS file, 
  (
    SELECT 
      PI1.alt 
    FROM 
      `cscart_products__images` PI1 
    WHERE 
      PI1.original_file_id = F1.id
  ) AS file_alt, 
  F2.id AS big_file_id, 
  F2.path AS big_file, 
  (
    SELECT 
      PI2.alt 
    FROM 
      `cscart_products__images` PI2 
    WHERE 
      PI2.watermark_big_file_id = F2.id
  ) AS big_file_alt, 
  F3.id AS small_file_id, 
  F3.path AS small_file, 
  (
    SELECT 
      PI3.alt 
    FROM 
      `cscart_products__images` PI3 
    WHERE 
      PI3.watermark_small_file_id = F3.id
  ) AS small_file_alt 
FROM 
  `cscart_products__images` AS `PI` 
  LEFT JOIN `files` AS `F1` ON `F1`.`id` = `PI`.`original_file_id` 
  LEFT JOIN `files` AS `F2` ON `F2`.`id` = `PI`.`watermark_big_file_id` 
  LEFT JOIN `files` AS `F3` ON `F3`.`id` = `PI`.`watermark_small_file_id` 
WHERE 
  `PI`.`product_id` = 25665

Query time 0.00051

Result

product_id file_id file file_alt big_file_id big_file big_file_alt small_file_id small_file small_file_alt
25665 283887 https://s3.timeweb.cloud/482029f9-prod/products__images/25665_dd1cb7abe6f0_processed_lot_81215_20170403094252_oooaba.ru_6126_new_3.8_1.jpg.jpg 283895 https://s3.timeweb.cloud/482029f9-prod/products__images/25665_afe06d8d5140_processed_lot_81215_20170403094252_oooaba.ru_6126_new_3.8_1.jpg.webp 283899 https://s3.timeweb.cloud/482029f9-prod/products__images/25665_778524fffdac_processed_lot_81215_20170403094252_oooaba.ru_6126_new_3.8_1.jpg.webp
25665 283906 https://s3.timeweb.cloud/482029f9-prod/products__images/25665_9e2499c48f2a_processed_lot_81215_20170403094302_oooaba.ru_6126_new_3.8_3.jpg.jpg 283915 https://s3.timeweb.cloud/482029f9-prod/products__images/25665_ea9ff6eb8133_processed_lot_81215_20170403094302_oooaba.ru_6126_new_3.8_3.jpg.webp 283920 https://s3.timeweb.cloud/482029f9-prod/products__images/25665_314b2b86ef12_processed_lot_81215_20170403094302_oooaba.ru_6126_new_3.8_3.jpg.webp
25665 283924 https://s3.timeweb.cloud/482029f9-prod/products__images/25665_e1b460c90e7d_processed_lot_81215_20170403094315_oooaba.ru_6126_new_3.8_6.jpg.jpg 283932 https://s3.timeweb.cloud/482029f9-prod/products__images/25665_f04d7b64cf21_processed_lot_81215_20170403094315_oooaba.ru_6126_new_3.8_6.jpg.webp 283934 https://s3.timeweb.cloud/482029f9-prod/products__images/25665_4dff096f4d94_processed_lot_81215_20170403094315_oooaba.ru_6126_new_3.8_6.jpg.webp
25665 283939 https://s3.timeweb.cloud/482029f9-prod/products__images/25665_c5ded4536724_processed_lot_81215_20170403094330_oooaba.ru_6126_new_3.8_7.jpg.jpg 283945 https://s3.timeweb.cloud/482029f9-prod/products__images/25665_dd9b9890ed3c_processed_lot_81215_20170403094330_oooaba.ru_6126_new_3.8_7.jpg.webp 283948 https://s3.timeweb.cloud/482029f9-prod/products__images/25665_e45a2979043b_processed_lot_81215_20170403094330_oooaba.ru_6126_new_3.8_7.jpg.webp
25665 283950 https://s3.timeweb.cloud/482029f9-prod/products__images/25665_cb80c17c2d49_processed_lot_81215_20170403094340_oooaba.ru_6126_new_3.8_10.jpg.jpg 283958 https://s3.timeweb.cloud/482029f9-prod/products__images/25665_5539bfc0849c_processed_lot_81215_20170403094340_oooaba.ru_6126_new_3.8_10.jpg.webp 283960 https://s3.timeweb.cloud/482029f9-prod/products__images/25665_a2c240fa3070_processed_lot_81215_20170403094340_oooaba.ru_6126_new_3.8_10.jpg.webp
25665 283963 https://s3.timeweb.cloud/482029f9-prod/products__images/25665_200e2ceb8d03_processed_lot_81215_20170403094356_oooaba.ru_6126_new_3.8_11.jpg.jpg 283971 https://s3.timeweb.cloud/482029f9-prod/products__images/25665_394ab70cf953_processed_lot_81215_20170403094356_oooaba.ru_6126_new_3.8_11.jpg.webp 283973 https://s3.timeweb.cloud/482029f9-prod/products__images/25665_86fa55b1cdd1_processed_lot_81215_20170403094356_oooaba.ru_6126_new_3.8_11.jpg.webp