UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WRM5rzPJ9eIHAhoJ5fLoOx4gzub+rDS14P6S5CWdKqI=' 
WHERE 
  key_id = 'd0bce485ee53c7ba724103d370c73e521575bc96a316a8c60904469b05be56af' 
  AND (
    token = 'WRM5rzPJ9eIHAhoJ5fLoOx4gzub+rDS14P6S5CWdKqI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037