Use MySQL query to get the external_db_id
Use NOW() instead of time...