UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'kJXfc95siwYpIWX0ZQAkMF8PY3+QayJopcwtG46yKFI=' 
WHERE 
  key_id = 'ac682c70a3675219d9d74c86772f79ccfafd7eff24e83c2ef6f6110137029cb5' 
  AND (
    token = 'kJXfc95siwYpIWX0ZQAkMF8PY3+QayJopcwtG46yKFI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038