UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'oq5pqvDaPn9Q1JTlXzwu6fL9Rgu35fosz4vgPM+9uvA=' 
WHERE 
  key_id = '1fedf9a46f09ea928efef27cbcce5941b7015212b7682b2b28c2093d0b4d1e47' 
  AND (
    token = 'oq5pqvDaPn9Q1JTlXzwu6fL9Rgu35fosz4vgPM+9uvA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042