optimized mysql statement to get new messages