UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Qa9v6WAKneNNsAAhJeHiJjGIKCuvuCvPvnyneCiIKUk='
WHERE
key_id = '0696a6c764e02013d2b7eb7bfe98d2ccfd0f2e1b66c3667678933256f3738778'
AND (
token = 'Qa9v6WAKneNNsAAhJeHiJjGIKCuvuCvPvnyneCiIKUk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)