I didn't have an index in the table by the sequence number. Anyway, I'm already done with the task. First I selected all records where some sequence numbers could be duplicates, then I just processed this file and re-number for each unique FK (did replace only if the sequence_number was not correct already).
If it's not broken, fix it until it is.
My Blog