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

Query time 0.00064

Result

product_id file_id file file_alt big_file_id big_file big_file_alt small_file_id small_file small_file_alt
30259 367551 https://s3.timeweb.cloud/482029f9-prod/products__images/30259_7c9e2951a5de_30260_f31ae78b867c_0_e45080eb4886_IMG_4530.JPG 367552 https://s3.timeweb.cloud/482029f9-prod/products__images/30259_82d7850db38d_30260_f31ae78b867c_0_e45080eb4886_IMG_4530.webp 367553 https://s3.timeweb.cloud/482029f9-prod/products__images/30259_83202ccf55c2_30260_f31ae78b867c_0_e45080eb4886_IMG_4530.webp
30259 367554 https://s3.timeweb.cloud/482029f9-prod/products__images/30259_db81a6d9d74c_30260_b3dd82985974_0_9b88682fcbf7_IMG_4532.JPG 367555 https://s3.timeweb.cloud/482029f9-prod/products__images/30259_955e930ba246_30260_b3dd82985974_0_9b88682fcbf7_IMG_4532.webp 367556 https://s3.timeweb.cloud/482029f9-prod/products__images/30259_0671f62b1a14_30260_b3dd82985974_0_9b88682fcbf7_IMG_4532.webp
30259 367557 https://s3.timeweb.cloud/482029f9-prod/products__images/30259_e409ea1dbb1d_30260_3467a81fc3fc_0_bd61a740383f_IMG_4535.JPG 367558 https://s3.timeweb.cloud/482029f9-prod/products__images/30259_1431aaaab166_30260_3467a81fc3fc_0_bd61a740383f_IMG_4535.webp 367559 https://s3.timeweb.cloud/482029f9-prod/products__images/30259_4972d477974a_30260_3467a81fc3fc_0_bd61a740383f_IMG_4535.webp
30259 367560 https://s3.timeweb.cloud/482029f9-prod/products__images/30259_48793c2bf785_30260_c1c30f93bf88_0_32d71f7f78bf_IMG_4533.JPG 367561 https://s3.timeweb.cloud/482029f9-prod/products__images/30259_bec6669209f3_30260_c1c30f93bf88_0_32d71f7f78bf_IMG_4533.webp 367562 https://s3.timeweb.cloud/482029f9-prod/products__images/30259_bf43735b8bba_30260_c1c30f93bf88_0_32d71f7f78bf_IMG_4533.webp
30259 367563 https://s3.timeweb.cloud/482029f9-prod/products__images/30259_ef9ff70e3d76_30260_31d5d7c206aa_0_057ca16e1a8f_IMG_4531.JPG 367564 https://s3.timeweb.cloud/482029f9-prod/products__images/30259_433a4916a3cc_30260_31d5d7c206aa_0_057ca16e1a8f_IMG_4531.webp 367565 https://s3.timeweb.cloud/482029f9-prod/products__images/30259_87460802d288_30260_31d5d7c206aa_0_057ca16e1a8f_IMG_4531.webp
30259 367566 https://s3.timeweb.cloud/482029f9-prod/products__images/30259_7e0fccd78c62_30260_1dd79f58e0d8_0_4910cbd7a63a_IMG_4534.JPG 367567 https://s3.timeweb.cloud/482029f9-prod/products__images/30259_e11e0bb1f970_30260_1dd79f58e0d8_0_4910cbd7a63a_IMG_4534.webp 367568 https://s3.timeweb.cloud/482029f9-prod/products__images/30259_a0225a7fcbc3_30260_1dd79f58e0d8_0_4910cbd7a63a_IMG_4534.webp