UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'rOtHEci6dXK0543q2HH3zvOjTa7jN1feeFxZXGw9afI='
WHERE
key_id = '9939f444adea3484b1db42420c9a19f9c1e1cd1b2f1ac02770035883ffb56484'
AND (
token = 'rOtHEci6dXK0543q2HH3zvOjTa7jN1feeFxZXGw9afI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)