UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JudXD44mi4bNoH0g8H8uTO1vwvnw89XLFYyIFF694Dc=' 
WHERE 
  key_id = '50e1857209afdce7bd2c5267b4869adefff1ce0723471b294d6df930107539ed' 
  AND (
    token = 'JudXD44mi4bNoH0g8H8uTO1vwvnw89XLFYyIFF694Dc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029