UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '7sXJRh7NIh0xcMt8U3bqIqZfliLjxTzihg4S3SAH/tg='
WHERE
key_id = 'e2bfb890f55cebdb045c5a7ab3f7e97ff5a83d8099325ab67d9ba143cef22135'
AND (
token = '7sXJRh7NIh0xcMt8U3bqIqZfliLjxTzihg4S3SAH/tg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)