I have an external hard drive that on these hot days suffers of overheating. So I thought that I could bypass the problem by slowing down the speed of the transfer of the files, it will take longer, but at least it won't switch off after about twenty minutes from the start.
You're going after the wrong solution!
Just keep the drive cool. You can possibly improve air circulation, or you can make sure the airflow around the drive isn't blocked. Or perhaps it was just poorly designed, and you should consider a drive with better cooling.
Or your fan may not be working properly. Open things up and see if there is a lot of dust restricting air flow, or perhaps some hair got caught up in the fan.
Connect the drive to the Mac through a powered USB 2 hub. This will force the drive to use USB 2 transfer speeds.
For example, here is an image taken from System Information after connecting an USB HDD connected directly to the USB port on a 2013 iMac. This image shows the transfer speed is up to 5 Gb/s.
After connecting the drive through a powered USB 2 hub, the image shown below shows the transfer speed is now up to 480 Mb/s. Also, the current being used is less, which should result in less heat generated.