It's a math problem mostly and there's lots of ways to do it depending upon the type of motion you want. But the simplest way I would go about it is to do it is with percentages and linear motion. Here's an example.
First you need a number that goes up when your speed is down, and down when your speed is up. I chose to express the speed as a percentage, then take the inverse of it. So when current_speed goes up, the output of the equation goes down.
Inverse percentage of speed = 1 - (current_speed / overall_max_speed)
Then I decided to incorporate a min and max zoom level so you have a definable range. So first I multiplied the inverse percent of speed to scale the max zoom level.
Scaled max zoom = max_zoom * (1 - (current_speed / overall_max_speed))
Then I just add the min zoom to the whole thing to ensure we don't ever get zero, and also so we can control the lowest zoom level. So here's the entire equation.
Set Layout Scale = min_zoom + (max_zoom * (1 - (current_speed / overall_max_speed)))
The zoom range is between min_zoom and (max_zoom + min_zoom).
I hope that helps!