A download that hangs at a few bytes per second can sit there forever. --speed-limit and --speed-time make curl give up when it stays that slow for too long.
The two options work as a pair: a speed in bytes per second, and how many seconds the transfer may stay below it.
curl --speed-limit 1000 --speed-time 30 -O https://example.com/images/big.iso
If the download runs slower than 1000 bytes per second for 30 seconds in a row, curl aborts it with exit code 28. The short forms are -Y and -y. If you only set the time, the speed limit defaults to 1 byte per second, which catches a transfer that has completely frozen.
I prefer this over --max-time for big files. A maximum time has to be long enough for the slowest good download, so it does little against a stall. The speed check reacts to the stall itself and leaves a slow but working download alone.
It pairs well with retries: a script can run curl -C - --speed-limit 1000 --speed-time 30 again after exit code 28 and continue where it stopped. Keep in mind it only watches the transfer itself. A server that never answers the connection is a job for --connect-timeout.
Further reading: curl man page, curl exit codes