UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'dNZZQaeJCSaLS0N7kdZEoGu5UO6nYkGQE8NHOSTZ1dU='
WHERE
key_id = 'ae032930af30f26292c9d6a3abf0542165f1c72f98a169247900fc28be7f046b'
AND (
token = 'dNZZQaeJCSaLS0N7kdZEoGu5UO6nYkGQE8NHOSTZ1dU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)