UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'YqajLlYAKZG7HvCdLIf8+WDADMNmV9nO1626KbK2lh8='
WHERE
key_id = 'e874baf54fbb628e7a61793331bf6bc726f1abd1fbac530d4c50a3561d5d7926'
AND (
token = 'YqajLlYAKZG7HvCdLIf8+WDADMNmV9nO1626KbK2lh8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)