UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ymqpOFQWYadzWEQWTM0QWNFLoIlU4qBXiVwrnBhfvRc='
WHERE
key_id = '316c46fbd1e6b8f828b7adfdd7edb7661b3fe566038f7b0635c04ccddada041f'
AND (
token = 'ymqpOFQWYadzWEQWTM0QWNFLoIlU4qBXiVwrnBhfvRc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)