Yes I think it could be done, it really is dependent on how we build the expression, what functions are available etc.
Let me see if I could build a sample for you OR the other crude option is to return both headers, then handle the "conditional check" at application layer.
Since this is a new query, Refer to this thread for the solution
siteminder expression response : conditional checks
Regards
Hubert