UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '2p4eulTjmbdg6h4Uzjk9nrEa7XpH3B/+oJc+frhkDUg=' 
WHERE 
  key_id = 'c76c131acf0e026afacda5b2e00bce64d88585038b287a31a364536fe2fd488b' 
  AND (
    token = '2p4eulTjmbdg6h4Uzjk9nrEa7XpH3B/+oJc+frhkDUg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041