UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'F1SrmNoCkzNlpSimaC77NsCXilAUKggjTIyo0OKcAIQ=' 
WHERE 
  key_id = '3971279a2fd7539471ff8e005195f50b8bce8a74db689025158f89319e7e41d8' 
  AND (
    token = 'F1SrmNoCkzNlpSimaC77NsCXilAUKggjTIyo0OKcAIQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031