UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'a5FZrkHpViYjUOzHGksVyqwd+X97q7aTeq7HFmljiRk='
WHERE
key_id = 'b6ddaaf99a954b530b4f20dc9f48dd698116a9cfebb7b89ca592e5c7906ba50f'
AND (
token = 'a5FZrkHpViYjUOzHGksVyqwd+X97q7aTeq7HFmljiRk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)