Cleanup isexpired() and add islocked()