You want to set up a system of equations using the variables you don't know. The boat speed B and the time it travels one way, T. The two equations will be for going upstream and downstream, both using d = r*t.
Downstream: d = r*t --> 62 = (6 + B)*T
Upstream: d = r*t --> 31 = (-6 + B)*T
Then use what you know about solving systems to find B! Good luck, I hope this helps.