Actually with curl you can get funky, use a temp directory in /tmp to download the stuff then check the curl return value if its an error then don't move the files from the temp location to the actual location, if there is no error condition then move the old files out and move new from the temp location.
For inspiration you can look at the script for sanesecurity updates it uses the same logic.
http://www.sanesecurity.co.uk/clamav...nesecurity.txt