Server error when installing a theme

Whenever I try to install a starter theme on my site through the Hub, I always get a server error.

Server error status: Gateway Timeout [504]

That's the error I get and the theme doesn't install.

I also get another error when i try to install the theme remotely from the Hib on the web. I says delayed execution time of 55000 milliseconds