Use the MySQL SEC_TO_TIME function.
Example:
mysql> SELECT SEC_TO_TIME(2378);
-> '00:39:38'
So you can write your SQL query as:
SELECT username, score, SEC_TO_TIME(timeran) as timetaken FROM gamescores ORDER BY Time DESC
Your code then becomes:
{$rank} |
{$row['username']} |
{$row['timetaken']} |
{$row['score']} |