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

Query time 0.00096

Result

product_id file_id file file_alt big_file_id big_file big_file_alt small_file_id small_file small_file_alt
28876 366113 https://s3.timeweb.cloud/482029f9-prod/products__images/28876_3ae305d42db6_28939_057335ed2da7_28876_0fc059919d42_28877_72e54e2a7dce_28876_f9cc48c976ff_IMG_4430.JPG 366114 https://s3.timeweb.cloud/482029f9-prod/products__images/28876_abb97a75035f_28939_057335ed2da7_28876_0fc059919d42_28877_72e54e2a7dce_28876_f9cc48c976ff_IMG_4430.webp 366115 https://s3.timeweb.cloud/482029f9-prod/products__images/28876_36fd048ae43f_28939_057335ed2da7_28876_0fc059919d42_28877_72e54e2a7dce_28876_f9cc48c976ff_IMG_4430.webp
28876 366116 https://s3.timeweb.cloud/482029f9-prod/products__images/28876_5729743463ab_28939_41941be72188_28876_f3786f399faa_28877_df7167f55240_28876_7f6505eaf593_IMG_4431.JPG 366117 https://s3.timeweb.cloud/482029f9-prod/products__images/28876_70710b7a0fdc_28939_41941be72188_28876_f3786f399faa_28877_df7167f55240_28876_7f6505eaf593_IMG_4431.webp 366118 https://s3.timeweb.cloud/482029f9-prod/products__images/28876_00f6d027fa85_28939_41941be72188_28876_f3786f399faa_28877_df7167f55240_28876_7f6505eaf593_IMG_4431.webp
28876 366119 https://s3.timeweb.cloud/482029f9-prod/products__images/28876_08bb7165a1da_28939_7b4e2022664c_28876_63fdfcb2ea10_28877_aedf4fb7acdf_28876_14ffeaaace7e_IMG_4432.JPG 366120 https://s3.timeweb.cloud/482029f9-prod/products__images/28876_a94321149dca_28939_7b4e2022664c_28876_63fdfcb2ea10_28877_aedf4fb7acdf_28876_14ffeaaace7e_IMG_4432.webp 366121 https://s3.timeweb.cloud/482029f9-prod/products__images/28876_6b9d4177c165_28939_7b4e2022664c_28876_63fdfcb2ea10_28877_aedf4fb7acdf_28876_14ffeaaace7e_IMG_4432.webp
28876 366122 https://s3.timeweb.cloud/482029f9-prod/products__images/28876_aa4509d9f7be_28939_84f0cd27886f_28876_359cf828ba08_28877_9cedbda973ea_28876_62e7d5dc9527_IMG_4433.JPG 366123 https://s3.timeweb.cloud/482029f9-prod/products__images/28876_c2b0c2872be6_28939_84f0cd27886f_28876_359cf828ba08_28877_9cedbda973ea_28876_62e7d5dc9527_IMG_4433.webp 366124 https://s3.timeweb.cloud/482029f9-prod/products__images/28876_25885e260f0f_28939_84f0cd27886f_28876_359cf828ba08_28877_9cedbda973ea_28876_62e7d5dc9527_IMG_4433.webp
28876 366125 https://s3.timeweb.cloud/482029f9-prod/products__images/28876_44de660e43f3_28939_57609ce8d707_28876_eb167e5f1f9d_28877_baf8799d3e6a_28876_9e451a021d34_IMG_4434.JPG 366126 https://s3.timeweb.cloud/482029f9-prod/products__images/28876_9c5edb9fa743_28939_57609ce8d707_28876_eb167e5f1f9d_28877_baf8799d3e6a_28876_9e451a021d34_IMG_4434.webp 366127 https://s3.timeweb.cloud/482029f9-prod/products__images/28876_bb1a55397762_28939_57609ce8d707_28876_eb167e5f1f9d_28877_baf8799d3e6a_28876_9e451a021d34_IMG_4434.webp