UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'DhMP/IXPV7HzgrsITV/4Q9dZEOsLLkdA0LNr9Ak/pko=' 
WHERE 
  key_id = 'b82584f1986f37f121a39ef16c2e82620c7be3f3712707d70295cc183b550953' 
  AND (
    token = 'DhMP/IXPV7HzgrsITV/4Q9dZEOsLLkdA0LNr9Ak/pko=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026