UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'cGo7LuPsboE4Y40TSXKTCNCzEqgg3HXnTmF7/ktfcwk='
WHERE
key_id = 'd743ccb1f612bdf38c2514e28a968a2ea05930badae00dcb0be55544657a40ac'
AND (
token = 'cGo7LuPsboE4Y40TSXKTCNCzEqgg3HXnTmF7/ktfcwk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)