UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '69bX+MKXvd6pIfh9nYRA1x5JuYEvGcu3H1wAgiglTOQ='
WHERE
key_id = '9f8467ebbab0e98e26830646c1f9ddf34f7eb81a093b8cc9aed89c0407a14801'
AND (
token = '69bX+MKXvd6pIfh9nYRA1x5JuYEvGcu3H1wAgiglTOQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)