MDL-46651 Backup: Handle duplicate course completions during restore

Cron can cause duplicate completion records if triggered during a long
running restore process. If this is the case, replace the new record
with the record from the backup file