Updated queries to exclude expired messages