UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UG9tYroVuA7DR5zJjdXbEz7aVP868TN2R+BDJdTaad0=' 
WHERE 
  key_id = 'f44de445761ebcdf8e9dd2625bb5fc020454b56326481263fe59967ed4caa766' 
  AND (
    token = 'UG9tYroVuA7DR5zJjdXbEz7aVP868TN2R+BDJdTaad0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021