Don't escape sortorder if it is for RAND() or RANDOM()

Resubmitted cleanly