Check the ferry schedule for a departure from Rafina instead of from Piraeus. If you can't get to Mykonos in a timely fashion from Piraeus maybe you can get there from Rafina. You will need to get back from Hydra early so you can take the Piraeus-Airport Express Bus X96 from the Port bus terminal (every 30 minutes or so--the trip takes 75 minutes) near the Metro Station to the airport, where you can catch the next bus to Rafina. You can catch the Rafina bus from the designated area opposite the Sofitel Hotel, which is just 200m from the arrivals exit. The trip takes around 50 minutes. You can buy the ticket from the bus driver for €5pp when entering the bus.
The departure hours are as follows (Monday-Sunday):
From the Athens Airport to Rafina: 04:50, 05:40, 06:10, 07:05, 08:50, 10:30, 12:00, 12:15, 13:15, 13:30,
14:10, 15:20, 16:30, 16:45, 18:00, 19:20. 20:40, 20:45, 22:20.
I'm guessing it will take a total of about 3 hours to get to Rafina going this way.
Another route would be to take the Green Line suburban train from the Piraeus Port Station to the Viktoria Station, then walk 2 blocks to the Pedion Areos Park Bus Terminal where you would catch a bus to Rafina. I think going to the airport would be less confusing and you don't have to worry about getting lost on the way or struggling with luggage because the Rafina Bus leaves from the airport very close to the X96 bus stop. The Rafina-Mykonos ferry leaves Rafina at 5:30pm so you should have ample time to get there from the airport, and it takes about 4.5 hours to reach Mykonos (10:10pm)