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` = 28956

Query time 0.00058

Result

product_id file_id file file_alt big_file_id big_file big_file_alt small_file_id small_file small_file_alt
28956 366645 https://s3.timeweb.cloud/482029f9-prod/products__images/28956_d30177f87741_28958_9d8698085ef7_28956_9bc6c5d00897_28957_578581f527a8_0_a2b7b5927f00_IMG_4550.JPG 366646 https://s3.timeweb.cloud/482029f9-prod/products__images/28956_54b64e525b44_28958_9d8698085ef7_28956_9bc6c5d00897_28957_578581f527a8_0_a2b7b5927f00_IMG_4550.webp 366647 https://s3.timeweb.cloud/482029f9-prod/products__images/28956_4c709d4c0eb9_28958_9d8698085ef7_28956_9bc6c5d00897_28957_578581f527a8_0_a2b7b5927f00_IMG_4550.webp
28956 366648 https://s3.timeweb.cloud/482029f9-prod/products__images/28956_99fd93d0ecee_28958_6ea78c6cb4a6_28956_4319a8f84cae_28957_2d8273d09ee7_0_b120bd732b2c_IMG_4548.JPG 366649 https://s3.timeweb.cloud/482029f9-prod/products__images/28956_66c525dd1fb9_28958_6ea78c6cb4a6_28956_4319a8f84cae_28957_2d8273d09ee7_0_b120bd732b2c_IMG_4548.webp 366650 https://s3.timeweb.cloud/482029f9-prod/products__images/28956_483326d10e3a_28958_6ea78c6cb4a6_28956_4319a8f84cae_28957_2d8273d09ee7_0_b120bd732b2c_IMG_4548.webp
28956 366651 https://s3.timeweb.cloud/482029f9-prod/products__images/28956_d7911d25e807_28958_a20a7d7beb62_28956_e347a81ddf9d_28957_a9bfcb5f0290_0_d7295f948641_IMG_4546.JPG 366652 https://s3.timeweb.cloud/482029f9-prod/products__images/28956_bce9151eb4f4_28958_a20a7d7beb62_28956_e347a81ddf9d_28957_a9bfcb5f0290_0_d7295f948641_IMG_4546.webp 366653 https://s3.timeweb.cloud/482029f9-prod/products__images/28956_82ade10b21b5_28958_a20a7d7beb62_28956_e347a81ddf9d_28957_a9bfcb5f0290_0_d7295f948641_IMG_4546.webp
28956 366654 https://s3.timeweb.cloud/482029f9-prod/products__images/28956_8eb026e7b33e_28958_ecff282715ce_28956_2b66dfc603eb_28957_57a42a0e92fd_0_4a0c65a9828e_IMG_4547.JPG 366655 https://s3.timeweb.cloud/482029f9-prod/products__images/28956_a10ab07db06d_28958_ecff282715ce_28956_2b66dfc603eb_28957_57a42a0e92fd_0_4a0c65a9828e_IMG_4547.webp 366656 https://s3.timeweb.cloud/482029f9-prod/products__images/28956_3715774757c8_28958_ecff282715ce_28956_2b66dfc603eb_28957_57a42a0e92fd_0_4a0c65a9828e_IMG_4547.webp
28956 366657 https://s3.timeweb.cloud/482029f9-prod/products__images/28956_cef44a23f17b_28958_10337ae353d0_28956_53df09324276_28957_d50bcd5380f3_0_87cabbb0224c_IMG_4551.JPG 366658 https://s3.timeweb.cloud/482029f9-prod/products__images/28956_046a1737e8b5_28958_10337ae353d0_28956_53df09324276_28957_d50bcd5380f3_0_87cabbb0224c_IMG_4551.webp 366659 https://s3.timeweb.cloud/482029f9-prod/products__images/28956_70ea727a779c_28958_10337ae353d0_28956_53df09324276_28957_d50bcd5380f3_0_87cabbb0224c_IMG_4551.webp