UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8sdOGqnJpq6o+ffSTcHYbokGQq5PxKd5GYc2c6LXA0k='
WHERE
key_id = 'a3823362906e676ffb3f5c4c90ffadb88190d0dc375f2646c38d4bd9a1a8f797'
AND (
token = '8sdOGqnJpq6o+ffSTcHYbokGQq5PxKd5GYc2c6LXA0k='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)