SELECT u.email,
    FROM_UNIXTIME(u.lastaccess, "%d.%m.%Y %H:%i:%s") "user_last_access",
    c.id,
    c.fullname,
    FROM_UNIXTIME(ci.timecreated, "%d.%m.%Y %H:%i:%s") "certificate_created"
    FROM mdl_customcert_issues ci
    LEFT JOIN mdl_customcert cc ON ci.customcertid = cc.id
    LEFT JOIN mdl_user u ON u.id = ci.userid
    LEFT JOIN mdl_course c ON c.id = cc.course
WHERE DATE(FROM_UNIXTIME(ci.timecreated)) = DATE_SUB(CURDATE(), INTERVAL 1 DAY);