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

Query time 0.00108

Result

product_id file_id file file_alt big_file_id big_file big_file_alt small_file_id small_file small_file_alt
32408 414926 https://s3.timeweb.cloud/482029f9-prod/products__images/32408_87ee81262dcd_33434_1cb35d9eb1ae_32408_b55d548d34c4_32409_94ee05be99a9_0_0c14a3436e27_7dd960cc-1c87-49f7-ba90-a2a1 414927 https://s3.timeweb.cloud/482029f9-prod/products__images/32408_58a40c7b2437_33434_1cb35d9eb1ae_32408_b55d548d34c4_32409_94ee05be99a9_0_0c14a3436e27_7dd960cc-1c87-49f7-ba90-a2a1 414928 https://s3.timeweb.cloud/482029f9-prod/products__images/32408_03108c99a0ee_33434_1cb35d9eb1ae_32408_b55d548d34c4_32409_94ee05be99a9_0_0c14a3436e27_7dd960cc-1c87-49f7-ba90-a2a1
32408 414929 https://s3.timeweb.cloud/482029f9-prod/products__images/32408_aadfb0183e72_33434_004f7de78389_32408_37f9bacc81ab_32409_c49bb443419c_0_04eeb904e3a3_78986c11-a865-4049-b3da-bbf2 414930 https://s3.timeweb.cloud/482029f9-prod/products__images/32408_bafcf917d0f1_33434_004f7de78389_32408_37f9bacc81ab_32409_c49bb443419c_0_04eeb904e3a3_78986c11-a865-4049-b3da-bbf2 414931 https://s3.timeweb.cloud/482029f9-prod/products__images/32408_3c7291e3a820_33434_004f7de78389_32408_37f9bacc81ab_32409_c49bb443419c_0_04eeb904e3a3_78986c11-a865-4049-b3da-bbf2
32408 414932 https://s3.timeweb.cloud/482029f9-prod/products__images/32408_40185bb30cb1_33434_6fce87d1c7b5_32408_97958c7b7cfd_32409_4a267b2cf9c0_0_20730aeae61d_42a9ad47-ab22-488c-a1d6-8773 414933 https://s3.timeweb.cloud/482029f9-prod/products__images/32408_33fdf6e9b528_33434_6fce87d1c7b5_32408_97958c7b7cfd_32409_4a267b2cf9c0_0_20730aeae61d_42a9ad47-ab22-488c-a1d6-8773 414934 https://s3.timeweb.cloud/482029f9-prod/products__images/32408_7abe74dc5bba_33434_6fce87d1c7b5_32408_97958c7b7cfd_32409_4a267b2cf9c0_0_20730aeae61d_42a9ad47-ab22-488c-a1d6-8773
32408 414935 https://s3.timeweb.cloud/482029f9-prod/products__images/32408_21e968c21d45_33434_7ec55de5548e_32408_fc4ab4893769_32409_981d53ddc493_0_8d48ea09e106_eb26f3ab-709e-47cd-97d3-88f0 414936 https://s3.timeweb.cloud/482029f9-prod/products__images/32408_27a724896201_33434_7ec55de5548e_32408_fc4ab4893769_32409_981d53ddc493_0_8d48ea09e106_eb26f3ab-709e-47cd-97d3-88f0 414937 https://s3.timeweb.cloud/482029f9-prod/products__images/32408_dd5729dc6098_33434_7ec55de5548e_32408_fc4ab4893769_32409_981d53ddc493_0_8d48ea09e106_eb26f3ab-709e-47cd-97d3-88f0