SELECT
`id`,
`timestamp`,
`rating`
FROM
(
SELECT
`id`,
`timestamp`,
`rating`,
@timestamp_rank := IF(@current_timestamp = `timestamp`, @timestamp_rank + 1, 1) AS `timestamp_rank`,
@current_timestamp := `timestamp`
FROM
`rating_log`
ORDER BY
`timestamp` DESC,
`rating` DESC
) `ranked`
WHERE
`timestamp_rank` <= 10;