UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KO8s5PtLIS4iFOH9wtJvQTmjAkWp7OnHS1MnBZv52Zc=' 
WHERE 
  key_id = 'eaa9fc0014e9a07b714000c18f2f80c705681a2a5011a9799d0a90c6dba16837' 
  AND (
    token = 'KO8s5PtLIS4iFOH9wtJvQTmjAkWp7OnHS1MnBZv52Zc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023