Matt Coles scored the fastest fifty in this season T20 Blast as Hampshire beat Essex, to keep their hopes of a home draw in the quarter-finals alive.