migrations: Allow idempotent unlock in `TryLock`
Created by: efritz
Pulled from #29831. This PR adds a flag to prevent the replay of a SQL query which can be called explicitly or on defer. We should allow it to be called multiple times to ensure at-least-once semantics on the way out of a function.