One of the steps listed here should solve your problems.
Upon trying to launch a third-party title on Steam, you may experience
this error. The most common causes of this issue are listed below:
If the game is a recent release, or was purchased during a sale While we
do our best to anticipate demand from our users, occasionally we may
run out of keys to provide for your purchase. When we are out of keys,
this error will appear. You will be issued a key as soon as we have
been given more by the game's publisher.
Although the above is unlikely since you have got your CD keys. I think the following maybe the solution for your case, since you have been in offline mode for a while.
Problem Occurs After Updating Steam
If this problem occurred directly after a Steam update and the firewall is already
disabled, please try this process: Log out and exit Steam Navigate to
C:\Program Files\Steam (the default location). If you have installed
Steam to a different folder, please locate that folder now. Rename the
file "ClientRegistry.blob" to ClientRegistryOld.blob and then close
the Steam folder Launch Steam and login. Steam should update,
re-create the file, and then you will be able to play Connection
Trouble If you are currently experiencing intermittent connection
problems, you may also experience this error. Please contact your
Internet Service Provider to make sure there are no current outages in
service at this time.