UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'S/w38XtPGiIuKjot/kfeHUhgmMqMju5FS6UYEzj1eWE=' 
WHERE 
  key_id = '72e89e3d05c941398b6a9e8d4477cce13d69e290dabfa1e134acc35ee1af7215' 
  AND (
    token = 'S/w38XtPGiIuKjot/kfeHUhgmMqMju5FS6UYEzj1eWE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037