Was just in Livorno and the port now has a "No Walking" rule that is strictly enforced. (A guard actually caught us and made us turn back) The taxis that are by the ship will not take you to the train station because they are looking for full day tours.
We had to board a bus to downtown Livorno (15 minute ride) and then grad a taxi to the train station (10 minute ride) All in all, it took about 45 minutes to get to the train station from the port. The return from the train station is easy. Just grab a taix and they will take you right to the ship.
As for when you can leave the ship, it depends on when the ship is cleared by immigration. Sometimes it happens quickly and sometimes it takes a while.
Have a great cruise!