UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'cdhOIbL/tGgPGpUmG02z4un9g0jNQ6zd6FqbXU3I800='
WHERE
key_id = '339e08657f1b4cb5e6c6554e915ac2d4402d9040d0e69ead87eae17b32aec4dd'
AND (
token = 'cdhOIbL/tGgPGpUmG02z4un9g0jNQ6zd6FqbXU3I800='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)