For HTTP, the option is -x with the full URL: curl -x http://username:password@IP:20001 https://destination. For SOCKS5, switch to --socks5 and port 20481.
The most common mistake
A 407 here is almost always a password with a special character and no quotes, or the HTTP port used with --socks5. The two protocols do not mix.
If it times out, repeat with --max-time 20. If it starts answering, the address is fine and the default deadline was the short one.