UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'yzyS0/YpHkdVuroPlKkQgllG6eynknP7qXVIsmmoNrU='
WHERE
key_id = '6739f30d20c4b5e1756dbe5d9007513458a484c826f3427b78a9d75cc930ae4a'
AND (
token = 'yzyS0/YpHkdVuroPlKkQgllG6eynknP7qXVIsmmoNrU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)