UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'z4fzKwwV2ctICU7p0JpbJyLQUxl4iet5Jlbu9MiVi0Y='
WHERE
key_id = '58180bbf5509f66902beb592d0901aa9af4f8d8de4a5072610df3cb9467703e4'
AND (
token = 'z4fzKwwV2ctICU7p0JpbJyLQUxl4iet5Jlbu9MiVi0Y='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)