you should do something like the following if you are writing a Java expression.
return kcontext.getKnowledgeRuntime().getProcessInstance(<id>).getVariable("isValid");
If you wanna write a rule expression it will be in the same way as you showed before:
WorkflowProcessInstance(variables["isValid"] == <true|false>)
Cheers