Google Maps says 35 minutes. My current plan is to spend two nights in Astoria and incorporate a visit to Ecola Park/Cannon Beach in one of them. This gives me the option to visit the Maritime Museum if the weather is less stellar.
Since we will be going south along the coast, it would make sense to take the second night in Cannon Beach if the towns are further apart. For half an hour driving distance, I'd rather stay in the same motel for two nights then move.
Question is, is this really about half an hour, not taking into account stops on the way, of course.