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