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