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